From e8eb9a84c1fc73a47ff596fd6b1e6eaab67a1980 Mon Sep 17 00:00:00 2001 From: Andrew Fyfe Date: Sun, 17 Dec 2017 20:21:40 +0000 Subject: [PATCH] passlib 1.7 depreciated the use of .encrypt(), use .hash() --- modoboa/core/password_hashers/advanced.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) 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)