verify_password

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

Verify a password given salt and key.

Parameters
  • password (str or int or float) – input as a password

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

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

  • iterations (int or 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