"""KDF measured within the app's 0.5 CPU / 512MiB limit.""" import json import statistics import time from argon2 import PasswordHasher hasher=PasswordHasher(time_cost=2,memory_cost=19456,parallelism=1) hashes=[];values=[] for _ in range(12): started=time.perf_counter();encoded=hasher.hash('synthetic-benchmark-input');hasher.verify(encoded,'synthetic-benchmark-input') values.append((time.perf_counter()-started)*1000);hashes.append(encoded) assert len(set(hashes))==12 print(json.dumps({'algorithm':'argon2id','memory_kib':19456,'time_cost':2,'parallelism':1,'samples':12, 'cpu_limit':.5,'memory_limit_mib':512,'operation':'hash + verify','min_ms':round(min(values),2), 'median_ms':round(statistics.median(values),2),'max_ms':round(max(values),2),'distinct_salts':True},indent=2))