user_hash_password

Versions
7
user_hash_password($password, $count_log2 = 0)

Hash a password using a secure hash.

Parameters

$password A plain-text password.

$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

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

▾ 3 functions call user_hash_password()

user_authenticate in modules/user/user.module
Try to validate the user's login credentials locally.
user_save in modules/user/user.module
Save changes to a user account or add a new user.
user_update_7000 in modules/user/user.install
Increase the length of the password field to accommodate better hashes.

Code

includes/password.inc, line 179

<?php
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);
  }
  return _password_crypt($password, _password_generate_salt($count_log2));
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.