14 lines
455 B
Python
14 lines
455 B
Python
from passlib.context import CryptContext
|
|
|
|
password_context = CryptContext(schemes=["sha256_crypt"], deprecated="auto")
|
|
|
|
|
|
def hash_password(password: str) -> str:
|
|
"""Hashes a plain text password."""
|
|
return password_context.hash(password)
|
|
|
|
|
|
def verify_password(plain_password: str, hashed_password: str) -> bool:
|
|
"""Verifies a plain text password against a hashed password."""
|
|
return password_context.verify(plain_password, hashed_password)
|