"""Password logic.""" import bcrypt def check(password, hashed_password): """Verify if two passwords are identical using bcrypt. Args: password (str): the clear password. hashed_password (str): the encrypted password (which is stored in our db). Returns: bool: if the passwords are identical """ return bcrypt.hashpw(password, hashed_password) == hashed_password def encrypt(password): """Encrypt a clear password. Args: password (str): the password to encrypt Returns: str: the encrypted password. """ return bcrypt.hashpw(password, bcrypt.gensalt(14))