20 lines
489 B
Python
20 lines
489 B
Python
"""Definition of verify_password function."""
|
|
|
|
import bcrypt
|
|
|
|
|
|
def verify_password(password: str, hashed_password: str) -> bool:
|
|
"""Verify a password against a hashed password.
|
|
|
|
Args:
|
|
password: Plain text password to verify
|
|
hashed_password: Previously hashed password
|
|
|
|
Returns:
|
|
True if password matches, False otherwise
|
|
"""
|
|
result: bool = bcrypt.checkpw(
|
|
password.encode("utf-8"), hashed_password.encode("utf-8")
|
|
)
|
|
return result
|