Beispiel #1
0
def check_hash(pwd: str, hsh: bytes) -> bool:
    try:
        result = bcrypt.checkpw(
            password=pwd.encode(),
            hashed_password=hsh,
        )
    except (TypeError, ValueError) as e:
        raise CheckPasswordHashException(str(e))
    return result
Beispiel #2
0
def check_hash(password: str, hsh: bytes):
    try:
        result = bcrypt.checkpw(
            password=password.encode(),
            hashed_password=hsh,
        )
    except (TypeError, ValueError) as error:
        raise CheckPasswordHashException(str(error))

    if not result:
        raise CheckPasswordHashException