34 'algo' => $this->config[
'algo'],
35 'rounds' => $this->config[
'cost'],
36 'length' => $this->config[
'length']
44 public function crypt( $password ) {
45 if ( count( $this->args ) == 0 ) {
46 $this->args[] = base64_encode( random_bytes( 16 ) );
50 $this->params[
'algo'],
52 base64_decode( $this->args[0] ),
53 (
int)$this->params[
'rounds'],
54 (
int)$this->params[
'length'],
57 if ( !is_string(
$hash ) ) {
61 $this->hash = base64_encode(
$hash );
Helper class for password hash types that have a delimited set of parameters inside of the hash.
Show an error when any operation involving passwords fails to run.
string $hash
String representation of the hash without the type.
A PBKDF2-hashed password.
crypt( $password)
Hash a password and store the result in this object.
getDefaultParams()
Return an ordered array of default parameters for this password hash.
getDelimiter()
Returns the delimiter for the parameters inside the hash.