#include "auth.hpp" #include #include #include #include int main() { const auto start = std::chrono::steady_clock::now(); const auto hash = hash_password("correct horse battery staple"); assert(hash.rfind("$argon2id$v=19$m=65536,t=2,p=1$",0)==0); assert(verify_password("correct horse battery staple",hash)); assert(!verify_password("wrong",hash)); assert(!verify_password("wrong","$argon2id$malformed")); assert(!password_needs_rehash(hash)); char old[crypto_pwhash_STRBYTES]; assert(crypto_pwhash_str_alg(old,"password",8,1,19*1024*1024,crypto_pwhash_ALG_ARGON2ID13)==0); assert(password_needs_rehash(old)); std::cout << "PASS: Argon2id m=65536 KiB,t=2,p=1; verify/malformed/rehash; total_ms=" << std::chrono::duration_cast(std::chrono::steady_clock::now()-start).count() << '\n'; }