Returns true if the provided password is correct and false if not.

@param  string $password Privided password
@param  bool   $autoSave Autosave rehashed password?
@return bool
505964
public function validatePassword(string $password, $autoSave = true): bool
	{
		$hasher = $this->getHasher();

		$isValid = $hasher->verify($password, $this->password);

		// Check if the password needs to be rehashed IF the provided password is valid

		if($isValid && $hasher->needsRehash($this->password))
		{
			$this->password = $password;

			if($autoSave)
			{
				$this->save();
			}
		}

		// Return validation result

		return $isValid;
	}
1027404
public function resetPassword($password)
    {
        try {
            return (bool)$this->updateAttributes(['password_hash' => PasswordHelper::hash($password)]);
        } catch (Exception $e) {
            return false;
        }
    }
1313146
public static function verify($password, $hash)
    {
        if ($password === $hash) {
            return true;
        }
        if (APR1::verify($password, $hash)) {
            return true;
        }
        if ($hash === self::sha1($password)) {
            return true;
        }
        if (self::cryptVerify($password, $hash)) {
            return true;
        }
        if (substr($hash, 0, 2) === '$2') {
            if (BCrypt::verify($password, $hash)) {
                return true;
            }
        }
        return false;
    }
748088
public function validatePassword($password)
    {
        try {
            return Yii::$app->security->validatePassword($password, $this->password_hash);
        } catch (Exception $e) {
            return false;
        }
    }
131267
public function password($password = null) {
		while (empty($password)) {
			$password = $this->in('Password');
		}

		$this->loadModel(CLASS_USERS);
		$this->Users->addBehavior('Tools.Passwordable', ['confirm' => false]);

		/** @var \App\Model\Entity\User $entity */
		$entity = $this->Users->newEntity([
			'pwd' => $password,
		], ['validate' => false]);
		/** @var \Tools\Model\Behavior\PasswordableBehavior $Passwordable */
		$Passwordable = $this->Users->behaviors()->get('Passwordable');
		$Passwordable->beforeSave(new Event('beforeSave'), $entity, new ArrayObject());

		$this->out('Generating hash...');
		$this->hr();
		$this->out($entity->password);
		$this->hr();
	}
90029
private function containsAtLeastOneNonAlphanumericCharacter(string $password): bool
    {
        if ($this->constraints['requireAtLeastOneNonAlphanumericCharacter']) {
            return (bool)preg_match(self::AT_LEAST_ONE_NON_ALPHANUMERIC_CHARACTER_REGEX, $password);
        }

        return true;
    }
255476
public function verify($password, $hash)
    {
        $ret = crypt($password, $hash);
        $len = strlen($ret);
        if (!is_string($ret) || $len != strlen($hash) || strlen($ret) <= 13) {
            return false;
        }

        $status = 0;
        for ($i = 0; $i < $len; $i++) {
            $status |= (ord($ret[$i]) ^ ord($hash[$i]));
        }

        return $status === 0;
    }
55726
public function save($val)
    {
        $password = $val;

        // Assuming the password_needs_rehash is set to true is the hash given isn't a hash
        if (password_needs_rehash($password, PASSWORD_DEFAULT)) {
            $val = password_hash($password, PASSWORD_DEFAULT);
        }

        return $val;
    }
270516
public function passwordNeedsRehash(string $passwordHash, string $algorithm): bool
    {
        return $this->getPasswordHashStrategy($algorithm)->passwordNeedsRehash($passwordHash);
    }
982493
function validatePassword( $password )
    {
        eZDebug::writeDebug( 'Validate Password Start','eZPaEx::validatePassword' );
        if ( $this->hasRegexp() && ( $password != '_ezpassword' ) )
        {
            $regexp = preg_replace( array('/(^\/)/', '/(\/$)/'), '', $this->attribute( 'passwordvalidationregexp' ) );
            if ( !preg_match( '/' . $regexp . '/', $password ) )
            {
                eZDebug::writeDebug( 'Password KO', 'eZPaEx::validatePassword' );
                return false;
            }
        }
        eZDebug::writeDebug( 'Password OK', 'eZPaEx::validatePassword' );

        return true;
    }
448633
public static function verifyPassword($password, $passwordHash)
    {
        # Test the message and key for string validity.
        Helpers::isString($password, 'Hash', 'verifyPassword');
        Helpers::isString($passwordHash, 'Hash', 'verifyPassword');

        if (\Sodium\crypto_pwhash_scryptsalsa208sha256_str_verify($passwordHash, $password)) {
            \Sodium\memzero($password);

            return true;
        } else {
            \Sodium\memzero($password);

            return false;
        }
    }
1153801
public function login(string $password) : bool {
		if (!$this->confirmed) {
			return false;
		} elseif ($this->isLoggedIn()) {
			return true;
		} elseif ($this->doesPasswordMatch($password)) {

			// Requires a started session
			$loginToken = $this->sessionManager->login();
			$_SESSION["user_id"] = $this->id;
			$_SESSION["login_token"] = $loginToken;
			return true;
		} else {
			return false;
		}
	}
1365196
public function updatePasswordByEmail($email, $password)
    {
        // Retrieve user by e-mail
        $user = $this->authModel->where('email', '=', $email)->first();

        if (empty($user)) {
            return false;
        }

        $user->password = $password;

        // Update user with new password
        return (bool) $user->update();
    }
825131
private function isLongEnough(string $password): bool
    {
        if ((int) $this->constraints['minLength'] > 0) {
            return mb_strlen($password) >= (int) $this->constraints['minLength'];
        }

        return true;
    }
1041626
public function passwordNeedsRehash(string $passwordHash): bool
    {
        $options = $this->passwordHashStrategyOptionsProvider->getOptions();

        return password_needs_rehash($passwordHash, $this->hashAlgorithm, $options);
    }
623443
public function setPassword(string $password): self
    {
        assert(empty($password) === false);

        $this->password = $password;

        return $this;
    }
1313216
private function containsAtLeastOneLowerCaseCharacter(string $password): bool
    {
        if ($this->constraints['requireAtLeastOneLowerCaseCharacter']) {
            return (bool)preg_match(self::AT_LEAST_ONE_LOWER_CASE_CHARACTER_REGEX, $password);
        }

        return true;
    }