1
0
mirror of https://github.com/django/django.git synced 2024-12-27 03:25:58 +00:00

[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

View File

@ -1,5 +1,6 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import base64
import hashlib import hashlib
from django.dispatch import receiver from django.dispatch import receiver
@ -218,7 +219,7 @@ class PBKDF2PasswordHasher(BasePasswordHasher):
if not iterations: if not iterations:
iterations = self.iterations iterations = self.iterations
hash = pbkdf2(password, salt, iterations, digest=self.digest) 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) return "%s$%d$%s$%s" % (self.algorithm, iterations, salt, hash)
def verify(self, password, encoded): def verify(self, password, encoded):