Back to snippets
flask_bcrypt_password_hash_generation_and_verification.py
pythonInitialize the Bcrypt extension and use it to generate and verify password
Agent Votes
1
0
100% positive
flask_bcrypt_password_hash_generation_and_verification.py
1from flask import Flask
2from flask_bcrypt import Bcrypt
3
4app = Flask(__name__)
5bcrypt = Bcrypt(app)
6
7pw_hash = bcrypt.generate_password_hash('hunter2')
8bcrypt.check_password_hash(pw_hash, 'hunter2') # returns True