From 5f8da527abf6ce1d995d4f6454a07f7e442f7fd5 Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Thu, 9 Aug 2012 07:25:35 -0700 Subject: [PATCH] [py3k] use the base64 module, instead of bytes.encode('base64') --- django/contrib/auth/hashers.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/django/contrib/auth/hashers.py b/django/contrib/auth/hashers.py index c676cf84db..45c1f88ab2 100644 --- a/django/contrib/auth/hashers.py +++ b/django/contrib/auth/hashers.py @@ -1,5 +1,6 @@ from __future__ import unicode_literals +import base64 import hashlib from django.dispatch import receiver @@ -218,7 +219,7 @@ class PBKDF2PasswordHasher(BasePasswordHasher): if not iterations: iterations = self.iterations hash = pbkdf2(password, salt, iterations, digest=self.digest) - hash = hash.encode('base64').strip() + hash = base64.b64encode(hash).strip() return "%s$%d$%s$%s" % (self.algorithm, iterations, salt, hash) def verify(self, password, encoded):