Property | Type | Description | |
---|---|---|---|
$algorithm | string | Hash algorithm to use, see hash_algos() | |
$derivedKeyLength | integer | Derived key length | |
$dynamicSaltLength | integer | Length of the dynamic random salt to generate in bytes | |
$iterationCount | integer | Hash iteration count, high counts (>10.000) make brute-force attacks unfeasible |
Method | Description | |
---|---|---|
__construct ( integer $dynamicSaltLength, integer $iterationCount, integer $derivedKeyLength, string $algorithm ) | Construct a PBKDF2 hashing strategy with the given parameters | |
hashPassword ( string $password, string $staticSalt = null ) : string | Hash a password for storage using PBKDF2 and the configured parameters. | |
validatePassword ( string $password, string $hashedPasswordAndSalt, string $staticSalt = null ) : boolean | Validate a password against a derived key (hashed password) and salt using PBKDF2. |
public __construct ( integer $dynamicSaltLength, integer $iterationCount, integer $derivedKeyLength, string $algorithm ) | ||
$dynamicSaltLength | integer | Length of the dynamic random salt to generate in bytes |
$iterationCount | integer | Hash iteration count, high counts (>10.000) make brute-force attacks unfeasible |
$derivedKeyLength | integer | Derived key length |
$algorithm | string | Hash algorithm to use, see hash_algos() |
public hashPassword ( string $password, string $staticSalt = null ) : string | ||
$password | string | Cleartext password that should be hashed |
$staticSalt | string | Static salt that will be appended to the random dynamic salt |
return | string | A Base64 encoded string with the derived key (hashed password) and dynamic salt |
public validatePassword ( string $password, string $hashedPasswordAndSalt, string $staticSalt = null ) : boolean | ||
$password | string | The cleartext password |
$hashedPasswordAndSalt | string | The derived key and salt in Base64 encoding as returned by hashPassword for verification |
$staticSalt | string | Static salt that will be appended to the dynamic salt |
return | boolean | TRUE if the given password matches the hashed password |
protected string $algorithm | ||
return | string |
protected int $derivedKeyLength | ||
return | integer |
protected int $dynamicSaltLength | ||
return | integer |
protected int $iterationCount | ||
return | integer |