Flask – Password Hash

Hashlib

import hashlib

password = 'pa$$w0rd'
password_hash = hashlib.md5(password.encode())

print(password_hash.hexdigest())

Bcrypt

import bcrypt

password = request.form['password'].encode('utf-8')
hash_password = bcrypt.hashpw(password, bcrypt.gensalt())

Leave a Reply

Your email address will not be published. Required fields are marked *