注释优化
This commit is contained in:
parent
e9be684b2e
commit
7b7828daa0
@ -1,11 +1,12 @@
|
||||
from passlib.context import CryptContext
|
||||
|
||||
# 创建一个密码上下文对象,指定使用 bcrypt 加密算法
|
||||
pwd_context = CryptContext(schemes=["bcrypt"], deprecated="auto")
|
||||
|
||||
def get_password_hash(password: str) -> str:
|
||||
"""Generate password hash using bcrypt"""
|
||||
"""生成密码的哈希值,使用 bcrypt 算法进行加密"""
|
||||
return pwd_context.hash(password)
|
||||
|
||||
def verify_password(plain_password: str, hashed_password: str) -> bool:
|
||||
"""Verify password against stored hash"""
|
||||
"""验证输入的明文密码是否与存储的哈希密码匹配"""
|
||||
return pwd_context.verify(plain_password, hashed_password)
|
||||
|
Loading…
x
Reference in New Issue
Block a user