def verify(password, hash):
    """
    Verify a password against a passed hash
    """
    _, algorithm, cost, salt, password_hash = hash.split("$")

    password = pbkdf2.pbkdf2_hex(password, salt, int(cost) * 500)

    return _safe_str_cmp(password, password_hash)
Verify a password against a passed hash