function _password_enforce_log2_boundaries

_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

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;
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/includes!password.inc/function/_password_enforce_log2_boundaries/7.x