mirror of
https://github.com/borgbackup/borg.git
synced 2024-12-27 10:18:12 +00:00
borg benchmark cpu: add kdf timings
Note: A KDF shall be expensive to compute to slow down attacks on your key encryption / your passphrase.
This commit is contained in:
parent
23b27cfd0c
commit
3fe622dd92
1 changed files with 9 additions and 0 deletions
|
@ -611,6 +611,15 @@ def chunkit(chunker_name, *args, **kwargs):
|
||||||
for spec, func in tests:
|
for spec, func in tests:
|
||||||
print(f"{spec:<24} {size:<10} {timeit(func, number=100):.3f}s")
|
print(f"{spec:<24} {size:<10} {timeit(func, number=100):.3f}s")
|
||||||
|
|
||||||
|
from borg.helpers.passphrase import Passphrase
|
||||||
|
print("KDFs (slow is GOOD, use argon2!) ===============================")
|
||||||
|
count = 5
|
||||||
|
for spec, func in [
|
||||||
|
("pbkdf2", lambda: Passphrase('mypassphrase').kdf(b'salt'*8, PBKDF2_ITERATIONS, 32)),
|
||||||
|
("argon2", lambda: Passphrase('mypassphrase').argon2(32, b'salt'*8, 3, 65536, 1, 'id')),
|
||||||
|
]:
|
||||||
|
print(f"{spec:<24} {count:<10} {timeit(func, number=count):.3f}s")
|
||||||
|
|
||||||
from borg.compress import CompressionSpec
|
from borg.compress import CompressionSpec
|
||||||
print("Compression ====================================================")
|
print("Compression ====================================================")
|
||||||
for spec in [
|
for spec in [
|
||||||
|
|
Loading…
Reference in a new issue