You are here

function _password_enforce_log2_boundaries in Drupal 7

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
Check whether a user's hashed password needs to be replaced with a new hash.
_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 121
Secure password hashing functions for user authentication.

Code

function _password_enforce_log2_boundaries($count_log2) {
  if ($count_log2 < DRUPAL_MIN_HASH_COUNT) {
    return DRUPAL_MIN_HASH_COUNT;
  }
  elseif ($count_log2 > DRUPAL_MAX_HASH_COUNT) {
    return DRUPAL_MAX_HASH_COUNT;
  }
  return (int) $count_log2;
}