3 namespace Drupal\Core\Password;
6 * Secure password hashing functions for user authentication.
8 interface PasswordInterface {
11 * Maximum password length.
13 const PASSWORD_MAX_LENGTH = 512;
16 * Hash a password using a secure hash.
18 * @param string $password
19 * A plain-text password.
22 * A string containing the hashed password, or FALSE on failure.
24 public function hash($password);
27 * Check whether a plain text password matches a hashed password.
29 * @param string $password
30 * A plain-text password
35 * TRUE if the password is valid, FALSE if not.
37 public function check($password, $hash);
40 * Check whether a hashed password needs to be replaced with a new hash.
42 * This is typically called during the login process when the plain text
43 * password is available. A new hash is needed when the desired iteration
44 * count has changed by a modification of the password-service in the
45 * dependency injection container or if the user's password hash was
46 * generated in an update like user_update_7000() (see the Drupal 7
50 * The existing hash to be checked.
53 * TRUE if the hash is outdated and needs rehash.
55 public function needsRehash($hash);