Skip to content

Instantly share code, notes, and snippets.

@jayd3e
Created July 11, 2012 06:03
Show Gist options
  • Save jayd3e/3088268 to your computer and use it in GitHub Desktop.
Save jayd3e/3088268 to your computer and use it in GitHub Desktop.
secret = 'dfkasdfiq983ruasfn3rwd9fas'
# This is the hash that we are going to pass to our user's e-mail
stored_hash = sha1()
stored_hash.update(os.urandom(60))
sent_hash = signed_serialize(stored_hash.hexdigest(), secret)
# Store stored_hash off into the db
# Send this to our user's e-mail
return sent_hash.hexdigest()
# When we get a request to verify an e-mail
stored_hash = # Get stored hash from db
if stored_hash == signed_deserialize(sent_hash, secret):
return True
return False
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment