#!/usr/bin/env python3 """Time one Argon2id hash with the stand parameters. Prints milliseconds only.""" import os import time from app.passwords import ITERATIONS, MEMORY_KIB, PARALLELISM, hash_password password = os.environ.get("ARGON2_SAMPLE_PASSWORD", "synthetic-measurement-password") started = time.perf_counter() hash_password(password) elapsed_ms = (time.perf_counter() - started) * 1000 print( "argon2id memory_kib=%s iterations=%s parallelism=%s elapsed_ms=%.1f" % (MEMORY_KIB, ITERATIONS, PARALLELISM, elapsed_ms) )