赞
踩
import bcrypt passwd = '123456' # 密码加密 salt = bcrypt.gensalt(rounds=10) hashed = bcrypt.hashpw(passwd.encode(), salt) print(salt) # b'$2b$12$BlfmESsgNnsQFCmpUnhDWO' print(hashed) # b'$2b$12$BlfmESsgNnsQFCmpUnhDWO2RbacoHJViT8AZR1qh3DDOHnZxB.J5q' # 密码校验 ret = bcrypt.checkpw(passwd.encode(), hashed) print(ret) # True
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。