I am trying to figure out what is the security that Drupal 6/7 uses by default to store passwords. Is it MD5, AES, SHA? I have been unable to find anything.
相关问题
- Views base64 encoded blob in HTML with PHP
- Laravel Option Select - Default Issue
- PHP Recursively File Folder Scan Sorted by Modific
- Can php detect if javascript is on or not?
- Using similar_text and strpos together
drupal 8 is using Phpass (modified version)
drupal 7 use SHA-512 + salt
drupal 6 and previous version were using md5 with no salt
Drupal 8 and Drupal 7 use SHA512 by default with a salt. They run the hash through PHP's hash function numerous times to increase the computation cost of generating a password's final hash (a security technique called stretching).
With Drupal 8, the implementation is object oriented. There is a PasswordInterface which defines a hash method. The default implementation of that interface is in the PhpassHashedPassword class. That class' hash method calls the crypt method passing in SHA512 as the hashing algorithm, a password, and a generated salt. The class' crypt method is nearly the same as Drupal 7's _password_crypt() method.
With Drupal 7, the implementation is split into a couple global functions: user_hash_password() and _password_crypt().
Drupal 6 uses MD5 without a salt. The relevant function is user_save().
Here is an example hash from Drupal 7:
"pass" : "$S$Dxl65W9p07LfQU7jvy5CnsyDpMoLujiAgzy123khcg1OJi/P9pKS"
The characters 0-2 are the type ( $S$ is Drupal 7 )
The binary result is then converted to a string using base64.
$count = 1 << $count_log2;
$hash = hash($algo, $salt . $password, TRUE);
do { $hash = hash($algo, $hash . $password, TRUE);
} while (--$count);
The whole process can be found in: mydrupalsite\includes\password.inc
It's MD5 and as I understand it, there isn't any salting used. Edit - that's drupal 6. For drupal 7 some more advanced hashing is used. A good article on it here - http://joncave.co.uk/2011/01/password-storage-in-drupal-and-wordpress/
It can be checked inside www\includes\password.inc
Its been clearly written that "// A normal Drupal 7 password using sha512."