Skip to content

Instantly share code, notes, and snippets.

@ronbeltran
Forked from danriti/gist:2869387
Last active August 29, 2015 14:20
Show Gist options
  • Save ronbeltran/67060861b477d4aece43 to your computer and use it in GitHub Desktop.
Save ronbeltran/67060861b477d4aece43 to your computer and use it in GitHub Desktop.
"""
The activation key for the ``UserProfile`` will be a
SHA1 hash, generated from a combination of the ``User``'s
email and a random salt.
"""
salt = hashlib.sha1(str(random.random())).hexdigest()[:5]
email = user.email
if isinstance(email, unicode):
email = email.encode('utf-8')
activation_key = hashlib.sha1(salt+email).hexdigest()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment