add level 3

This commit is contained in:
Матвей
2026-11-07 15:00:53 +03:00
parent eafb825657
commit 7b6c10cde9
54 changed files with 1593 additions and 120 deletions
+25
View File
@@ -0,0 +1,25 @@
#!/usr/bin/env python3
"""Measure local Argon2id hashing and verification without recording secrets."""
from statistics import median
from time import perf_counter
from argon2 import PasswordHasher
def main():
hasher = PasswordHasher(time_cost=2, memory_cost=19456, parallelism=1)
password = "synthetic-benchmark-password"
hashes, verifications = [], []
for _ in range(10):
started = perf_counter()
encoded = hasher.hash(password)
hashes.append((perf_counter() - started) * 1000)
started = perf_counter()
assert hasher.verify(encoded, password)
verifications.append((perf_counter() - started) * 1000)
print("Argon2id m=19456 KiB, t=2, p=1; samples=10")
print(f"hash median={median(hashes):.2f} ms; verify median={median(verifications):.2f} ms")
if __name__ == "__main__":
main()