summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2013-11-09 06:36:10 -0500
committerTim Graham <timograham@gmail.com>2013-11-09 10:21:19 -0500
commit4b9e932fd46eaac4774d229c40c2ee75f8fb759b (patch)
treeead3374c0da9fd4e447aa2249e83614cb091c314 /django
parentc9076a408c0d002babe78f5de6796e2a3a0e4731 (diff)
[1.6.x] Fixed #21398 -- Fixed BCryptSHA256PasswordHasher with py-bcrypt and Python 3.
Thanks arjan at anymore.nl for the report. Backport of d15985d81f from master
Diffstat (limited to 'django')
-rw-r--r--django/contrib/auth/hashers.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/django/contrib/auth/hashers.py b/django/contrib/auth/hashers.py
index e9e8215c09..ab46fc23e7 100644
--- a/django/contrib/auth/hashers.py
+++ b/django/contrib/auth/hashers.py
@@ -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)