You are here

function _password_enforce_log2_boundaries in Simple LDAP 7.2

Same name and namespace in other branches
  1. 7 simple_ldap_user/simple_ldap_user.password.inc \_password_enforce_log2_boundaries()

Ensures that $count_log2 is within set bounds.

Parameters

integer $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 Integer within set bounds that is closest to $count_log2.

2 calls to _password_enforce_log2_boundaries()
user_needs_new_hash in simple_ldap_user/simple_ldap_user.password.inc
Check whether a user's hashed password needs to be replaced with a new hash.
_password_generate_salt in simple_ldap_user/simple_ldap_user.password.inc
Generates a random base 64-encoded salt prefixed with settings for the hash.

File

simple_ldap_user/simple_ldap_user.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;
}