function PhpassHashedPassword::needsRehash

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/Password/PhpassHashedPassword.php \Drupal\Core\Password\PhpassHashedPassword::needsRehash()

Overrides PasswordInterface::needsRehash

File

core/lib/Drupal/Core/Password/PhpassHashedPassword.php, line 260

Class

PhpassHashedPassword
Secure password hashing functions based on the Portable PHP password hashing framework.

Namespace

Drupal\Core\Password

Code

public function needsRehash($hash) {
    // Check whether this was an updated password.
    if (substr($hash, 0, 3) != '$S$' || strlen($hash) != static::HASH_LENGTH) {
        return TRUE;
    }
    // Ensure that $count_log2 is within set bounds.
    $count_log2 = $this->enforceLog2Boundaries($this->countLog2);
    // Check whether the iteration count used differs from the standard number.
    return $this->getCountLog2($hash) !== $count_log2;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.