PythonFlask-Bcrypt对密码进行加密

网友投稿 723 2022-05-30

see: Python:bcrypt对密码进行加密和校验

文档

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环境下需要decode pw_hash = bcrypt.generate_password_hash('hunter2').decode('utf-8') print(pw_hash) # b$rSXRS7OFI2MmInOB/0tMgelZLCSby3o/okGPpaVUSTl6I2sCX.ogW ret = bcrypt.check_password_hash(pw_hash, 'hunter2') print(ret)

1

2

3

4

5

6

7

8

9

10

Python:Flask-Bcrypt对密码进行加密

11

12

13

14

Flask Python

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:关于内容付费
下一篇:Day.js轻量级 JavaScript 时间日期处理库可替代Moment.js
相关文章