"""Time the actual verification settings with synthetic values.""" import json import statistics import time from argon2 import Type, extract_parameters from src.security import hasher password = "Synthetic training password 7!" one = hasher.hash(password) assert one != hasher.hash(password) params = extract_parameters(one) assert params.type is Type.ID and params.memory_cost >= 19456 and params.time_cost >= 2 samples = [] for _ in range(12): start = time.perf_counter() assert hasher.verify(one, password) samples.append(1000 * (time.perf_counter() - start)) print(json.dumps({"type": params.type.name, "memory_kib": params.memory_cost, "iterations": params.time_cost, "parallelism": params.parallelism, "salt_bytes": params.salt_len, "runs": len(samples), "median_ms": round(statistics.median(samples), 2), "max_ms": round(max(samples), 2), "unique_salts": True}))