You are here

function user_hash_password in Simple LDAP 7.2

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

Hash a password using a secure hash.

Parameters

string $password: A plain-text password.

integer $count_log2: Optional integer to specify the iteration count. Generally used only during mass operations where a value less than the default is needed for speed.

Return value

string A string containing the hashed password (and a salt), or FALSE on failure.

1 call to user_hash_password()
SimpleLdapUserTestCase::drupalUser1Login in simple_ldap_user/simple_ldap_user.test
Log in with User 1.
1 string reference to 'user_hash_password'
SimpleLdapUserTestCase::drupalUser1Login in simple_ldap_user/simple_ldap_user.test
Log in with User 1.

File

simple_ldap_user/simple_ldap_user.password.inc, line 207
Secure password hashing functions for user authentication.

Code

function user_hash_password($password, $count_log2 = 0) {
  if (empty($count_log2)) {

    // Use the standard iteration count.
    $count_log2 = variable_get('password_count_log2', DRUPAL_HASH_COUNT);
  }
  $hash = _password_crypt('sha512', $password, _password_generate_salt($count_log2));
  SimpleLdapUser::hash($hash, $password);
  return $hash;
}