Python:Flask-Bcrypt對(duì)密碼進(jìn)行加密
see: Python:bcrypt對(duì)密碼進(jìn)行加密和校驗(yàn)
文檔
doc: https://flask-bcrypt.readthedocs.io/
pypi: https://pypi.org/project/Flask-Bcrypt/
github: https://github.com/maxcountryman/flask-bcrypt
pip install Flask-Bcrypt
1
使用示例
from flask import Flask from flask_bcrypt import Bcrypt app = Flask(__name__) bcrypt = Bcrypt(app) # python3環(huán)境下需要decode pw_hash = bcrypt.generate_password_hash('hunter2').decode('utf-8') print(pw_hash) # $2b$12$rSXRS7OFI2MmInOB/0tMgelZLCSby3o/okGPpaVUSTl6I2sCX.ogW ret = bcrypt.check_password_hash(pw_hash, 'hunter2') print(ret)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
Flask Python
版權(quán)聲明:本文內(nèi)容由網(wǎng)絡(luò)用戶投稿,版權(quán)歸原作者所有,本站不擁有其著作權(quán),亦不承擔(dān)相應(yīng)法律責(zé)任。如果您發(fā)現(xiàn)本站中有涉嫌抄襲或描述失實(shí)的內(nèi)容,請(qǐng)聯(lián)系我們jiasou666@gmail.com 處理,核實(shí)后本網(wǎng)站將在24小時(shí)內(nèi)刪除侵權(quán)內(nèi)容。