[ci skip] fix change with hex

This commit is contained in:
Matthieu Bourgain 2024-04-22 18:44:21 +02:00
commit 9cc277a60a
No known key found for this signature in database
GPG key ID: 33BA95C808890C39
2 changed files with 13 additions and 4 deletions

View file

@ -108,8 +108,8 @@ def _sha256_digest(key, salt, loops):
return tmp
def mysql_sha256_password_hash_hex(password, salt):
"""Return a MySQL compatible caching_sha2_password hash in hex format."""
def mysql_sha256_password_hash(password, salt):
"""Return a MySQL compatible caching_sha2_password hash in raw format."""
if len(salt) != 20:
raise ValueError("Salt must be 20 characters long.")
@ -118,3 +118,8 @@ def mysql_sha256_password_hash_hex(password, salt):
digest = _sha256_digest(password, salt, iteration)
return "$A${0:>03}${1}{2}".format(count, salt, digest).encode().hex().upper()
def mysql_sha256_password_hash_hex(password, salt):
"""Return a MySQL compatible caching_sha2_password hash in hex format."""
return mysql_sha256_password_hash(password, salt).encode().hex().upper()