function _password_enforce_log2_boundaries

7.x password.inc _password_enforce_log2_boundaries($count_log2)
6.x password.inc _password_enforce_log2_boundaries($count_log2)
5.x 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.

2 calls to _password_enforce_log2_boundaries()
user_needs_new_hash in includes/password.inc
_password_generate_salt in includes/password.inc
Generates a random base 64-encoded salt prefixed with settings for the hash.

File

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

Code

function _password_enforce_log2_boundaries($count_log2) {
  if ($count_log2 < FP_MIN_HASH_COUNT) {
    return FP_MIN_HASH_COUNT;
  }
  elseif ($count_log2 > FP_MAX_HASH_COUNT) {
    return FP_MAX_HASH_COUNT;
  }

  return (int) $count_log2;
}