Created
June 24, 2013 18:29
-
-
Save HugoPresents/5852288 to your computer and use it in GitHub Desktop.
Python generate bcrypt & check
This file contains hidden or 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
import bcrypt | |
def generate_password(str): | |
return bcrypt.hashpw(str, bcrypt.gensalt()) | |
def check_password(str, stored_hash): | |
hash_check = bcrypt.hashpw(str, stored_hash) | |
return hash_check == stored_hash |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment