Skip to content
Permalink
Browse files

Merge pull request #1686 from Arvedui/fix_rounds_parameter

fix regression that caused the rounds parameter to be ignored
  • Loading branch information...
tonioo committed Mar 1, 2019
2 parents 404f4bc + af72e52 commit dd2e8ab360040378fe918b3dd5b976d2c28fb869
Showing with 3 additions and 6 deletions.
  1. +3 −6 modoboa/core/password_hashers/advanced.py
@@ -36,8 +36,7 @@ def _encrypt(self, clearvalue, salt=None):
# 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 @@ def _b64encode(self, pwhash):

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 @@ def _b64encode(self, pwhash):

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)

0 comments on commit dd2e8ab

Please sign in to comment.
You can’t perform that action at this time.