[py3k] use the base64 module, instead of bytes.encode('base64')

This commit is contained in:
Alex Gaynor 2012-08-09 07:25:35 -07:00 committed by Alex Gaynor
parent 5c09c59bc7
commit 5f8da527ab
1 changed files with 2 additions and 1 deletions

View File

@ -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):