Inbox
python bcrypt
오렌지데이77
2024. 1. 30. 17:22
Notes
bcrpyt
title: install
pip install bcrypt
pip install pyjwt
title: code.py
import bcrypt
# example password
password = 'your_password'
# converting password to array of bytes
bytes = password.encode('utf-8')
# generating the salt
salt = bcrypt.gensalt()
# Hashing the password
hash = bcrypt.hashpw(bytes, salt)
# b to Database
# TODO
title: usage.py
import bcrypt
password = 'your_password'
b = bcrypt.checkpw(c.encode('utf-8'), b)
# b' from Database
# b와 b' 비교
title: 사용법.py import bcrypt 비밀번호 = 'your_password' b = bcrypt.checkpw(c.encode('utf-8'), b) # b' from Database # b와 b'비교