mirror of
https://github.com/django/django.git
synced 2025-10-25 14:46:09 +00:00
Fixed #21398 -- Fixed BCryptSHA256PasswordHasher with py-bcrypt and Python 3.
Thanks arjan at anymore.nl for the report.
This commit is contained in:
@@ -322,8 +322,10 @@ class BCryptSHA256PasswordHasher(BasePasswordHasher):
|
||||
|
||||
# Ensure that our data is a bytestring
|
||||
data = force_bytes(data)
|
||||
# force_bytes() necessary for py-bcrypt compatibility
|
||||
hashpw = force_bytes(bcrypt.hashpw(password, data))
|
||||
|
||||
return constant_time_compare(data, bcrypt.hashpw(password, data))
|
||||
return constant_time_compare(data, hashpw)
|
||||
|
||||
def safe_summary(self, encoded):
|
||||
algorithm, empty, algostr, work_factor, data = encoded.split('$', 4)
|
||||
|
||||
Reference in New Issue
Block a user