class Pbkdf2PasswordEncoder extends BasePasswordEncoder
Pbkdf2PasswordEncoder uses the PBKDF2 (Password-Based Key Derivation Function 2).
Providing a high level of Cryptographic security, PBKDF2 is recommended by the National Institute of Standards and Technology (NIST).
But also warrants a warning, using PBKDF2 (with a high number of iterations) slows down the process. PBKDF2 should be used with caution and care.
MAX_PASSWORD_LENGTH |
array | demergePasswordAndSalt(string $mergedPasswordSalt) Demerges a merge password and salt string. | from BasePasswordEncoder |
string | mergePasswordAndSalt(string $password, string $salt) Merges a password and a salt. | from BasePasswordEncoder |
bool | comparePasswords(string $password1, string $password2) Compares two passwords. | from BasePasswordEncoder |
bool | isPasswordTooLong(string $password) Checks if the password is too long. | from BasePasswordEncoder |
__construct(string $algorithm = 'sha512', bool $encodeHashAsBase64 = true, int $iterations = 1000, int $length = 40) | ||
string | encodePassword(string $raw, string $salt) Encodes the raw password. | |
bool | isPasswordValid(string $encoded, string $raw, string $salt) Checks a raw password against an encoded password. |
Demerges a merge password and salt string.
string | $mergedPasswordSalt | The merged password and salt string |
array | An array where the first element is the password and the second the salt |
Merges a password and a salt.
string | $password | The password to be used |
string | $salt | The salt to be used |
string | a merged password and salt |
InvalidArgumentException |
Compares two passwords.
This method implements a constant-time algorithm to compare passwords to avoid (remote) timing attacks.
string | $password1 | The first password |
string | $password2 | The second password |
bool | true if the two passwords are the same, false otherwise |
Checks if the password is too long.
string | $password | The password to check |
bool | true if the password is too long, false otherwise |
string | $algorithm | The digest algorithm to use |
bool | $encodeHashAsBase64 | Whether to base64 encode the password hash |
int | $iterations | The number of iterations to use to stretch the password hash |
int | $length | Length of derived key to create |
Encodes the raw password.
string | $raw | The password to encode |
string | $salt | The salt |
string | The encoded password |
Checks a raw password against an encoded password.
string | $encoded | An encoded password |
string | $raw | A raw password |
string | $salt | The salt |
bool | true if the password is valid, false otherwise |
© 2004–2017 Fabien Potencier
Licensed under the MIT License.
https://api.symfony.com/4.1/Symfony/Component/Security/Core/Encoder/Pbkdf2PasswordEncoder.html