8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-11-29 16:12:26 +00:00

Merge branch 'fix_md5_password' into 'master'

fix md5 password verification function

See merge request federez/re2o!420
This commit is contained in:
klafyvel 2019-05-01 19:58:14 +02:00
commit 2eeeb0c19a

View file

@ -157,9 +157,9 @@ class MD5PasswordHasher(hashers.BasePasswordHasher):
"""
assert encoded.startswith(self.algorithm)
salt = hash_password_salt(encoded)
return constant_time_compare(
b64encode(hashlib.md5(password.encode() + salt).digest() + salt),
encoded.encode())
return constant_time_compare(self.algorithm + "$" +
b64encode(hashlib.md5(password.encode() + salt).digest() + salt).decode(),
encoded)
def safe_summary(self, encoded):
"""