gh-99108: Add HACL* Blake2 implementation to hashlib (GH-119316)

This replaces the existing hashlib Blake2 module with a single implementation that uses HACL\*'s Blake2b/Blake2s implementations. We added support for all the modes exposed by the Python API, including tree hashing, leaf nodes, and so on. We ported and merged all of these changes upstream in HACL\*, added test vectors based on Python's existing implementation, and exposed everything needed for hashlib.

This was joint work done with @R1kM.

See the PR for much discussion and benchmarking details.   TL;DR: On many systems, 8-50% faster (!) than `libb2`, on some systems it appeared 10-20% slower than `libb2`.
This commit is contained in:
Jonathan Protzenko 2024-08-13 14:42:19 -07:00 committed by GitHub
parent ee1b8ce26e
commit 325e9b8ef4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
55 changed files with 11697 additions and 5236 deletions

View file

@ -69,9 +69,6 @@ PACKAGE_TO_FILES = {
"Lib/ctypes/macholib/fetch_macholib.bat",
],
),
"libb2": PackageFiles(
include=["Modules/_blake2/impl/**"]
),
"hacl-star": PackageFiles(
include=["Modules/_hacl/**"],
exclude=[