4require_once
'Services/Password/classes/class.ilBasePasswordEncoder.php';
26 foreach(
$config as $key => $value)
28 switch(strtolower($key))
37 if(!isset(
$config[
'cost']) && static::class == self::class)
66 $encoder =
new self(array(
'cost' => $cost));
67 $encoder->encodePassword(
'test',
'');
68 $end = microtime(
true);
70 while(($end -
$start) < $time_target && $cost < 32);
88 return parent::isSupportedByRuntime() && version_compare(phpversion(),
'5.5.0',
'>=');
108 if($costs < 4 || $costs > 31)
110 require_once
'Services/Password/exceptions/class.ilPasswordException.php';
125 require_once
'Services/Password/exceptions/class.ilPasswordException.php';
129 return password_hash($raw, PASSWORD_BCRYPT, array(
139 return password_verify($raw, $encoded);
147 return password_needs_rehash($encoded, PASSWORD_BCRYPT, array(
sprintf('%.4f', $callTime)
An exception for terminatinating execution or to throw for unit testing.
isPasswordTooLong($password)
Checks if the password is too long.
requiresReencoding($encoded)
{{Returns whether or not the a encoded password needs to be re-encoded.boolean}}
__construct(array $config=array())
benchmarkCost($time_target=0.05)
isPasswordValid($encoded, $raw, $salt)
{Checks a raw password against an encoded password.The raw password has to be injected into the encod...
encodePassword($raw, $salt)
{Encodes the raw password.string The encoded password}
isSupportedByRuntime()
{{Returns whether or not the encoder is supported by the runtime (PHP, HHVM, ...)boolean}}
Class for user password exception handling in ILIAS.