PasswordInterface
interface PasswordInterface (View source)
Secure password hashing functions for user authentication.
Constants
| PASSWORD_MAX_LENGTH |
Maximum password length. |
Methods
Hash a password using a secure hash.
Check whether a plain text password matches a hashed password.
Check whether a hashed password needs to be replaced with a new hash.
Details
string
hash(string $password)
Hash a password using a secure hash.
bool
check(string $password, string $hash)
Check whether a plain text password matches a hashed password.
bool
needsRehash(string $hash)
Check whether a hashed password needs to be replaced with a new hash.
This is typically called during the login process when the plain text password is available. A new hash is needed when the desired iteration count has changed by a modification of the password-service in the dependency injection container or if the user's password hash was generated in an update like user_update_7000() (see the Drupal 7 documentation).