diff --git a/modoboa/core/password_hashers/advanced.py b/modoboa/core/password_hashers/advanced.py index ad27ae865..0f526221c 100644 --- a/modoboa/core/password_hashers/advanced.py +++ b/modoboa/core/password_hashers/advanced.py @@ -34,7 +34,8 @@ class BLFCRYPTHasher(PasswordHasher): # rounds = parameters.get_global_parameter("rounds_number") # To get around this, I use the default of 12. rounds = 12 - return bcrypt.encrypt(clearvalue, rounds=rounds) + bcrypt.using(rounds=rounds) + return bcrypt.hash(clearvalue) def verify(self, clearvalue, hashed_value): return bcrypt.verify(clearvalue, hashed_value) @@ -55,7 +56,7 @@ class MD5CRYPTHasher(PasswordHasher): return pwhash def _encrypt(self, clearvalue, salt=None): - return md5_crypt.encrypt(clearvalue) + return md5_crypt.hash(clearvalue) def verify(self, clearvalue, hashed_value): return md5_crypt.verify(clearvalue, hashed_value) @@ -78,7 +79,8 @@ class SHA256CRYPTHasher(PasswordHasher): def _encrypt(self, clearvalue, salt=None): rounds = param_tools.get_global_parameter("rounds_number") - return sha256_crypt.encrypt(clearvalue, rounds=rounds) + sha256_crypt.using(rounds=rounds) + return sha256_crypt.hash(clearvalue) def verify(self, clearvalue, hashed_value): return sha256_crypt.verify(clearvalue, hashed_value) @@ -101,7 +103,8 @@ class SHA512CRYPTHasher(PasswordHasher): def _encrypt(self, clearvalue, salt=None): rounds = param_tools.get_global_parameter("rounds_number") - return sha512_crypt.encrypt(clearvalue, rounds=rounds) + sha512_crypt.using(rounds=rounds) + return sha512_crypt.hash(clearvalue) def verify(self, clearvalue, hashed_value): return sha512_crypt.verify(clearvalue, hashed_value)