FIX: encode string before hash.

This commit is contained in:
Julien Palard 2018-05-07 23:32:55 +02:00
parent 64ae8a29cc
commit a01e9e6c9b
1 changed files with 1 additions and 1 deletions

View File

@ -103,7 +103,7 @@ class Paste(models.Model):
"""Return hashed string."""
if not self.salt:
self.salt = str(uuid.uuid1())
return hashlib.sha512(raw+self.salt).hexdigest()
return hashlib.sha512((raw+self.salt).encode()).hexdigest()
def set_password(self, raw):
"""Define a hashed password."""