Skip to content

Commit

Permalink
Update SHA method when receiving a number.
Browse files Browse the repository at this point in the history
  • Loading branch information
wunki committed Oct 14, 2013
1 parent 09b43dc commit 81e1c42
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions userena/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ def generate_sha1(string, salt=None):
:return: Tuple containing the salt and hash.
"""
if not isinstance(string, (str, unicode)):
string = str(string)
if not salt:
salt = sha_constructor(str(random.random())).hexdigest()[:5]
hash = sha_constructor(salt+str(string.encode('utf-8'))).hexdigest()
Expand Down

0 comments on commit 81e1c42

Please sign in to comment.