feat: implement Argon2 algorithm

This commit is contained in:
2025-11-13 13:16:23 +00:00
parent 67ecdc80ad
commit 30f1f45d68
3 changed files with 69 additions and 0 deletions

View File

@@ -38,3 +38,17 @@ def test_pbkdf2_algorithm_respects_iterations():
salt2, hash2 = algo.hash("test", iterations=200000)
# Different iterations should produce different hashes even with same password
assert hash1 != hash2
def test_argon2_algorithm_hash_round_trip():
"""Verify Argon2 algorithm can hash and verify passwords."""
algo = get_algorithm("argon2")
salt, hashed = algo.hash("test password")
assert algo.verify("test password", salt, hashed)
assert not algo.verify("wrong password", salt, hashed)
def test_argon2_algorithm_identifier():
"""Verify Argon2 algorithm has correct identifier."""
algo = get_algorithm("argon2")
assert algo.identifier == "argon2"