verify_password

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

Verify if a password matches the provided salt and key.

Parameters:
  • password (str | int | float | bytes) – Password to be verified.

  • salt (bytes | str) – Salt used during hashing to enhance security; see also [OPS-HP-1].

  • key (bytes | str) – Hashed key generated using PBKDF2 algorithm (produced by hashlib.pbkdf2_hmac()).

  • iterations (int | None) – Number of iterations used in PBKDF2; defaults to 100000 if not specified.

Returns:

True if the input password matches the hashed key and salt, False otherwise.

Return type:

bool

See also