verify_password

pyhelpers.ops.verify_password(password, salt, key, iterations=None)[source]

Verify a password given salt and key.

Parameters:
  • password (str | int | float | bytes) – input as a password

  • salt (bytes | str) – random data; see also [OPS-HP-1]

  • key (bytes | str) – PKCS#5 password-based key (produced by the function hashlib.pbkdf2_hmac())

  • iterations (int | None) – size of the function hashlib.pbkdf2_hmac(), i.e. number of iterations of SHA-256; when salt_size=None (default), it uses 100000

Returns:

whether the input password is correct

Return type:

bool

See also