Generate bcrypt Password Hash using Python

bcrypt library

  1. Install bcrypt library from the command line:
pip install bcrypt
  1. Generate bcrypt password hash:
import bcrypt

cost = 14

password = 'Hello'
passwordHash = bcrypt.hashpw(password.encode('utf-8'), bcrypt.gensalt(cost))
passwordHash = passwordHash.decode('utf-8')

print(passwordHash)

Leave a Comment

Cancel reply

Your email address will not be published.