12 lines
420 B
Python
12 lines
420 B
Python
from passlib.context import CryptContext
|
|
|
|
pwd_context = CryptContext(schemes=["bcrypt"], deprecated="auto")
|
|
|
|
def get_password_hash(password: str) -> str:
|
|
"""Generate password hash using 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)
|