utils.gen.saltHash: encode string before hashing it.

This commit is contained in:
Valentin Lorentz 2012-08-04 17:12:23 +02:00
parent ab978a8c31
commit d3d93da602

View File

@ -148,7 +148,7 @@ def saltHash(password, salt=None, hash='sha'):
hasher = crypt.sha hasher = crypt.sha
elif hash == 'md5': elif hash == 'md5':
hasher = crypt.md5 hasher = crypt.md5
return '|'.join([salt, hasher(salt + password).hexdigest()]) return '|'.join([salt, hasher((salt + password).encode('utf8')).hexdigest()])
def safeEval(s, namespace={'True': True, 'False': False, 'None': None}): def safeEval(s, namespace={'True': True, 'False': False, 'None': None}):
"""Evaluates s, safely. Useful for turning strings into tuples/lists/etc. """Evaluates s, safely. Useful for turning strings into tuples/lists/etc.