Add ability to specify iteration count in Hash class.

This commit is contained in:
Taylor Otwell 2011-08-08 09:01:53 -05:00
parent f28a2c5a4b
commit d1934b731e
1 changed files with 6 additions and 5 deletions

View File

@ -12,9 +12,9 @@ class Hash {
* @param string $value
* @return string
*/
public static function make($value)
public static function make($value, $rounds = 10)
{
return static::hasher()->HashPassword($value);
return static::hasher($rounds)->HashPassword($value);
}
/**
@ -32,13 +32,14 @@ public static function check($value, $hash)
/**
* Create a new PHPass instance.
*
* @param int $rounds
* @return PasswordHash
*/
private static function hasher()
private static function hasher($rounds = 10)
{
require_once SYS_PATH.'vendor/phpass'.EXT;
return new \PasswordHash(10, false);
return new \PasswordHash($rounds, false);
}
}
}