Created
September 13, 2012 15:59
-
-
Save Rorosha/3715323 to your computer and use it in GitHub Desktop.
Basic Utility Functions
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
def email_check(email): | |
"""Checks to make sure user inputted email actually conforms to what an | |
email should look like. Returns True if everything looks right.""" | |
try: | |
pieces = email.split('@') | |
if ' ' not in pieces[0] and '.' in pieces[1]: | |
return True | |
except: | |
return False |
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
def pw_hash(pw): | |
"""Takes a string, and creates and returns a hexdigest. Keeps us from needing | |
to store actual passwords...""" | |
import hashlib | |
pw_digest = hashlib.new('sha1') | |
pw_digest.update(str(pw)) | |
return pw_digest.hexdigest() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment