blake3: add to requirements and borg benchmark cpu

This commit is contained in:
Thomas Waldmann 2026-05-14 14:52:03 +02:00
parent 4e8fa92ec8
commit ea13c3329e
No known key found for this signature in database
GPG key ID: 243ACFA951F78E01
2 changed files with 7 additions and 2 deletions

View file

@ -42,6 +42,7 @@ dependencies = [
"xxhash>=2.0.0",
"jsonargparse>=4.47.0",
"PyYAML>=6.0.2", # we need to register our types with yaml, jsonargparse uses yaml for config files
"blake3>=1.0.0",
]
[project.optional-dependencies]

View file

@ -214,16 +214,20 @@ class BenchmarkMixIn:
print(f"{spec:<24} {format_file_size(size):<10} {dt:.3f}s")
from ..crypto.low_level import hmac_sha256, blake2b_256
import blake3
if not args.json:
print("Cryptographic hashes / MACs ====================================")
else:
result["hashes"] = []
size = 1000000000
for spec, func in [
hashes_tests = [
("hmac-sha256", lambda: hmac_sha256(key_256, random_10M)),
("blake2b-256", lambda: blake2b_256(key_256, random_10M)),
]:
("blake3", lambda: blake3.blake3(random_10M, key=key_256).digest()),
("blake3-mt", lambda: blake3.blake3(random_10M, key=key_256, max_threads=blake3.blake3.AUTO).digest()),
]
for spec, func in hashes_tests:
dt = timeit(func, number=number_default)
if args.json:
result["hashes"].append({"algo": spec, "size": size, "time": dt})