项目初次搭建

This commit is contained in:
2025-02-13 16:29:28 +08:00
parent feef37cbd7
commit 3cb2a4c507
121 changed files with 19550 additions and 0 deletions

13
app/common/bcrypt_pw.py Normal file
View File

@ -0,0 +1,13 @@
import bcrypt
#使用bcrypt对密码进行加密
def hash_password(password):
# 生成盐值并使用 bcrypt 加密密码
salt = bcrypt.gensalt()
hashed = bcrypt.hashpw(password.encode('utf-8'), salt)
return hashed
def verify_password(provided_password, stored_password):
# 验证提供的密码是否与存储的哈希值匹配
return bcrypt.checkpw(provided_password.encode('utf-8'), stored_password.encode('utf-8'))