Skeleton contracts / contracts (pull_request) Blocked by required conditions
18 lines
768 B
Python
18 lines
768 B
Python
"""Measure the selected Argon2id cost using only synthetic input."""
|
|
from statistics import median
|
|
from time import perf_counter
|
|
|
|
from argon2 import PasswordHasher, Type
|
|
|
|
memory_kib, iterations, parallelism = 19456, 2, 1
|
|
hasher = PasswordHasher(time_cost=iterations, memory_cost=memory_kib,
|
|
parallelism=parallelism, hash_len=32, salt_len=16,
|
|
type=Type.ID)
|
|
samples = []
|
|
for _ in range(7):
|
|
started = perf_counter()
|
|
hasher.hash("synthetic-lab7-password")
|
|
samples.append((perf_counter() - started) * 1000)
|
|
print(f"algorithm=Argon2id memory_kib={memory_kib} iterations={iterations} parallelism={parallelism}")
|
|
print(f"samples_ms={','.join(f'{sample:.1f}' for sample in samples)} median_ms={median(samples):.1f}")
|