From af72e52db2e28a4d34bfcf4f5f525dc5d9e3d237 Mon Sep 17 00:00:00 2001 From: Arvedui Date: Thu, 28 Feb 2019 21:48:55 +0100 Subject: [PATCH] fix regression that caused the rounds parameter to be ignored --- modoboa/core/password_hashers/advanced.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/modoboa/core/password_hashers/advanced.py b/modoboa/core/password_hashers/advanced.py index 8aaaf506c..3024924fc 100644 --- a/modoboa/core/password_hashers/advanced.py +++ b/modoboa/core/password_hashers/advanced.py @@ -36,8 +36,7 @@ class BLFCRYPTHasher(PasswordHasher): # rounds = parameters.get_global_parameter("rounds_number") # To get around this, I use the default of 12. rounds = 12 - bcrypt.using(rounds=rounds) - return bcrypt.hash(clearvalue) + return bcrypt.hash(clearvalue, rounds=rounds) def verify(self, clearvalue, hashed_value): return bcrypt.verify(clearvalue, hashed_value) @@ -82,8 +81,7 @@ class SHA256CRYPTHasher(PasswordHasher): def _encrypt(self, clearvalue, salt=None): rounds = param_tools.get_global_parameter("rounds_number") - sha256_crypt.using(rounds=rounds) - return sha256_crypt.hash(clearvalue) + return sha256_crypt.hash(clearvalue, rounds=rounds) def verify(self, clearvalue, hashed_value): return sha256_crypt.verify(clearvalue, hashed_value) @@ -106,8 +104,7 @@ class SHA512CRYPTHasher(PasswordHasher): def _encrypt(self, clearvalue, salt=None): rounds = param_tools.get_global_parameter("rounds_number") - sha512_crypt.using(rounds=rounds) - return sha512_crypt.hash(clearvalue) + return sha512_crypt.hash(clearvalue, rounds=rounds) def verify(self, clearvalue, hashed_value): return sha512_crypt.verify(clearvalue, hashed_value)