add level 3
This commit is contained in:
@@ -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()
|
||||
Reference in New Issue
Block a user