ay/backend/core/hashing.py
2025-06-24 18:17:53 +02:00

11 lines
No EOL
448 B
Python

from passlib.context import CryptContext
pwd_context = CryptContext(schemes=["bcrypt"], deprecated="auto")
def verify_password(plain_password: str, hashed_password: str) -> bool:
"""Vérifie si un mot de passe clair correspond à un mot de passe haché."""
return pwd_context.verify(plain_password, hashed_password)
def get_password_hash(password: str) -> str:
"""Hache un mot de passe clair."""
return pwd_context.hash(password)