Drupal 7 hash - fixes
This commit is contained in:
@@ -61,7 +61,7 @@ class Phpass extends AbstractAlgorithm
|
||||
*
|
||||
* @return string|null Generated hash. Null on invalid settings.
|
||||
*/
|
||||
private function crypt($password, $setting)
|
||||
protected function crypt($password, $setting)
|
||||
{
|
||||
$countLog2 = strpos(self::ITOA64, $setting[3]);
|
||||
if ($countLog2 < 7 || $countLog2 > 30) {
|
||||
@@ -75,17 +75,29 @@ class Phpass extends AbstractAlgorithm
|
||||
return null;
|
||||
}
|
||||
|
||||
$hash = md5($salt . $password, true);
|
||||
$hash = $this->hash($salt . $password);
|
||||
do {
|
||||
$hash = md5($hash . $password, true);
|
||||
$hash = $this->hash($hash . $password);
|
||||
} while (--$count);
|
||||
|
||||
$output = substr($setting, 0, 12);
|
||||
$output .= $this->encode64($hash, 16);
|
||||
$output .= $this->encode64($hash, strlen($hash));
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply hash function to input.
|
||||
*
|
||||
* @param string $input Input string.
|
||||
*
|
||||
* @return string Hashed input.
|
||||
*/
|
||||
protected function hash($input)
|
||||
{
|
||||
return md5($input, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Encode binary input to base64 string.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user