Update Readme Files
This commit is contained in:
@@ -24,3 +24,16 @@ def test_hash_password_with_algorithm_parameter():
|
||||
"""Verify hash_password accepts algorithm parameter."""
|
||||
salt, hashed = hash_password("test", algorithm="pbkdf2")
|
||||
assert verify_password("test", salt, hashed, algorithm="pbkdf2")
|
||||
|
||||
|
||||
def test_backward_compatibility_with_old_pbkdf2_hashes():
|
||||
"""Verify existing PBKDF2 hashes still work without algorithm parameter."""
|
||||
# Simulate old hash created before algorithm parameter existed
|
||||
salt, hashed = hash_password("legacy-password")
|
||||
|
||||
# Verify using old API (no algorithm parameter)
|
||||
assert verify_password("legacy-password", salt, hashed)
|
||||
assert not verify_password("wrong", salt, hashed)
|
||||
|
||||
# Verify using new API with explicit pbkdf2
|
||||
assert verify_password("legacy-password", salt, hashed, algorithm="pbkdf2")
|
||||
|
||||
Reference in New Issue
Block a user