Created
July 11, 2012 06:03
-
-
Save jayd3e/3088268 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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