passlib 1.7 depreciated the use of <hash>.encrypt(), use <hash>.hash()

This commit is contained in:
Andrew Fyfe
2017-12-19 00:53:12 +00:00
parent 892160d5aa
commit e8eb9a84c1
+7 -4
View File
@@ -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)