Verifies a password

@param string $password
@param string $hash
@return bool
14484
public static function verify($password, $hash)
    {
        $salt = Binary::getSlice($hash, 0, self::SALT_FINAL_LENGTH + 7);
        return (crypt($password, $salt) === $hash);
    }
650634
public static function comparePasswordToHash( $plainText, $hash ) {
		if ( self::isBlowfishHash( $hash ) ) {
			$check = crypt( $plainText, $hash );

		} else {
			// horrible unsalted md5 that legacy app used for passwords
			$check = md5( $plainText );
		}

		return self::hashEquals( $hash, $check );
	}
804831
public function logIn(string $password, string $hash, array $user): bool
    {
        if (!$user || !password_verify($password, $hash)) {
            return false;
        }

        $this->session->set('user', $user);

        return true;
    }
805051
public static function passwordReHash($password = '', $hash = '')
    {
        if (self::verifyPassword($password, $hash)) {
            if (password_needs_rehash($hash, self::ALGORITHM_DEFAULT)) {
                return self::createPassword($password);
            }
        }

        return NULL;
    }
850900
function hash_verify (password, _hash) {
  let hash = _hash.split('|')
  switch (hash[1]) {
    case 'bcrypt':
      return bcrypt_compare(password, hash[0])
    default:
      return Promise.resolve(password === hash[0])
  }
}
1127956
public function checkPassword($password)
    {
        Deprecation::notice('5.0', 'Use Authenticator::checkPassword() instead');

        // With a valid user and password, check the password is correct
        $result = ValidationResult::create();
        $authenticators = Security::singleton()->getApplicableAuthenticators(Authenticator::CHECK_PASSWORD);
        foreach ($authenticators as $authenticator) {
            $authenticator->checkPassword($this, $password, $result);
            if (!$result->isValid()) {
                break;
            }
        }
        return $result;
    }
337907
public function verifyPassword(string $password, string $passwordHash): bool
    {
        return $this->passwordVerificationService->verifyPassword($password, $passwordHash);
    }
733780
public function hashExists($hash) 
    {
        $data = $this->getPasswordRequestData($hash);
        $h = '';
        foreach($data as $val) 
        {
            $h = $val->rh_login;
            //echo $h;
        }
        
        if(!empty($h)) {
            return true;
        }

        return false;   
    }
1339623
private function hashModeBcrypt($password)
    {
        $this->cwsDebug->titleH2('Create password hash using BCRYPT');
        $this->cwsDebug->labelValue('Password', $password);

        $ite = rand(self::BCRYPT_MIN_ITE, self::BCRYPT_MAX_ITE);
        $this->cwsDebug->labelValue('Iterations', $ite);

        $salt = $this->getBlowfishSalt($ite);
        $this->cwsDebug->labelValue('Salt', $salt);

        $hash = crypt($password, $salt);
        $this->cwsDebug->labelValue('Hash', $hash);
        $this->cwsDebug->labelValue('Length', strlen($hash));

        if (CRYPT_BLOWFISH == 1 && strlen($hash) == self::BCRYPT_LENGTH) {
            return $hash;
        }

        $this->error = 'Cannot generate the BCRYPT password hash...';
        $this->cwsDebug->error($this->error);
    }
49945
public function validate(string $password): bool
    {
        foreach ($this->validators as $validator) {
            $validator->validate($password);
        }

        return true;
    }
51399
function CheckAdminPassword(
      $password
  ) {
      return ($this->GetConfigAttribute('admin_password_hash') == md5($this->GetHashSalt().$password.$this->GetHashSalt()));
  }
1155038
public function password_verify_with_rehash($password, $hash, $uid)
    {
        if (!password_verify($password, $hash)) {
            return false;
        }
    
        if (password_needs_rehash($hash, PASSWORD_DEFAULT, ['cost' => $this->config->bcrypt_cost])) {
            $hash = $this->getHash($password);

            $query = "UPDATE {$this->config->table_users} SET password = ? WHERE id = ?";
            $query_prepared = $this->dbh->prepare($query);
            $query_prepared->execute([$hash, $uid]);
        }
    
        return true;
    }
1103639
public function checkPassword($password)
    {
        $valid = static::$dispatcher->until(new CheckingPassword($this, $password));

        if ($valid !== null) {
            return $valid;
        }

        return static::$hasher->check($password, $this->password);
    }
995256
private function checkModePbkdf2($password, $hash)
    {
        $this->cwsDebug->titleH2('Check password hash in PBKDF2 mode');
        $this->cwsDebug->labelValue('Password', $password);
        $this->cwsDebug->dump('Hash', $hash);

        $params = explode(self::PBKDF2_SEPARATOR, $hash);
        if (count($params) < self::PBKDF2_SECTIONS) {
            return false;
        }

        $algorithm = $params[self::PBKDF2_ALGORITHM_INDEX];
        $salt = $params[self::PBKDF2_SALT_INDEX];
        $ite = $params[self::PBKDF2_ITE_INDEX];
        $hash = base64_decode($params[self::PBKDF2_HASH_INDEX]);
        $this->cwsDebug->labelValue('Decoded hash', $hash);

        $checkHash = $this->getPbkdf2($algorithm, $password, $salt, $ite, strlen($hash), true);
        $this->cwsDebug->labelValue('Check hash', $checkHash);

        $result = $this->slowEquals($hash, $checkHash);
        $this->cwsDebug->labelValue('Valid?', ($result ? 'YES!' : 'NO...'));

        return $result;
    }
1043867
public function passwordNeedRehash(string $password) : bool
    {
        $options = [
            //'salt' => mcrypt_create_iv(22, MCRYPT_DEV_URANDOM), // Never use a static salt or one that is not randomly generated.
            'cost' => 12, // the default cost is 10
        ];

        if (password_needs_rehash($this->password, PASSWORD_DEFAULT, $options)) {
            $this->password = self::passwordHash($password);
            $this->update();

            return true;
        }

        return false;
    }
680071
function verify($pw,$hash) {
		$val=crypt($pw,$hash);
		$len=strlen($val);
		if ($len!=strlen($hash) || $len<14)
			return FALSE;
		$out=0;
		for ($i=0;$i<$len;$i++)
			$out|=(ord($val[$i])^ord($hash[$i]));
		return $out===0;
	}
1288880
public static function verify($string, $hash)
    {
        $pattern = '~^'.preg_quote(self::PREFIX).'(?<salt>[A-Za-z0-9\./]{8})\$(?<sub>[A-Za-z0-9\./]+)$~is';
        if (!preg_match($pattern, $hash, $matches)) {
            return false;
        }
        return ($matches['sub'] === self::createSubHash($string, $matches['salt']));
    }