Skip to content

Instantly share code, notes, and snippets.

@HugoPresents
Created June 24, 2013 18:29
Show Gist options
  • Save HugoPresents/5852288 to your computer and use it in GitHub Desktop.
Save HugoPresents/5852288 to your computer and use it in GitHub Desktop.
Python generate bcrypt & check
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