1 password.inc _password_enforce_log2_boundaries($count_log2)

Ensures that $count_log2 is within set bounds.

Parameters

$count_log2: Integer that determines the number of iterations used in the hashing process. A larger value is more secure, but takes more time to complete.

Return value

Integer within set bounds that is closest to $count_log2.

File

core/includes/password.inc, line 121
Secure password hashing functions for user authentication.

Code

function _password_enforce_log2_boundaries($count_log2) {
  if ($count_log2 < BACKDROP_MIN_HASH_COUNT) {
    return BACKDROP_MIN_HASH_COUNT;
  }
  elseif ($count_log2 > BACKDROP_MAX_HASH_COUNT) {
    return BACKDROP_MAX_HASH_COUNT;
  }

  return (int) $count_log2;
}