*
Validates a password with a given hash
@param password
@param correctHash
@returns {boolean}
333083
function (password, correctHash) {
            if (!this.validatePasswordLength(password)) {
                return false;
            }

            var elements = correctHash.split(this.$.delimiter);
            if (elements.length === 3) {
                return (this.createHash(password, elements[0], elements[1]) === correctHash);
            }
            return false;
        }
1065695
public boolean isPasswordCorrect(String password) {
		final String actualPassword = configurationRegistry.getString(updateConfigPasswordKey);
		return "".equals(actualPassword) || actualPassword != null && actualPassword.equals(password);
	}
333412
public static String computePasswordHash(final String password, final byte[] salt) {
    if (StringMan.isEmpty(password))
      return (StringMan.encodeBytesToString(salt));
    final KeySpec spec = new PBEKeySpec(password.toCharArray(), salt, 2048, 160);
    SecretKeyFactory f;
    try {
      f = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA1");
      final byte[] hash = f.generateSecret(spec).getEncoded();
      return StringMan.encodeBytesToString(hash);
    } catch (final NoSuchAlgorithmException ex) {
      throw new RuntimeException("Missing encryption algorithm:", ex);
    } catch (final InvalidKeySpecException ex) {
      throw new RuntimeException("Key spec is incorrect.", ex);
    }
  }
1323698
function (password, algorithm, salt) {

            return {
                hash: this.createHash(password, algorithm, salt),
                loginAttempts: 0,
                loginBlocked: null
            }

        }
227684
function fakeHash( record ) {
    // Not a real hash function - do not use in production
    return new Promise( (resolve, reject) => {
        if(!record) {
            return reject('record not defined');
        }
        if(!record.password) {
            return reject('record.password not defined');
        }
        // fake hashing - do not use in production
        record.password = '$' + getRandomInt(10000, 10000000);
        resolve(record);
    });
}
769887
protected function verifySodium($password, $hash)
    {
        if (strpos($hash, '$argon2i') === 0) {
            $result = \Sodium\crypto_pwhash_str_verify($hash, $password);

            \Sodium\memzero($password);

            return $result;
        } elseif (strpos($hash, '$7$C6') === 0) {
            $result = \Sodium\crypto_pwhash_scryptsalsa208sha256_str_verify($hash, $password);

            \Sodium\memzero($password);

            return $result;
        }

        return false;
    }
1362940
function checkPassword($password)
    {
        if ($this->password == '') {
            return false;
        }
        list ($algo, $salt, $hash) = explode(':', $this->password);
        if ($hash == $algo($salt . $password)) {
            return true;
        } else {
            return false;
        }
    }
562969
public static function validate($password, $hash) {
        $params = explode(":", $hash);
        if (count($params) < 4)
            return false;
        $pbkdf2 = base64_decode($params[self::$hash_pbkdf2_index]);
        return self::slowEquals(
                $pbkdf2, self::calculate(
                    $params[self::$hash_alogrithm_index], $password, $params[self::$hash_salt_index], (int) $params[self::$hash_iteration_index], strlen($pbkdf2), true
                )
        );
    }
493709
public function verify($password, $hash)
	{
		// Check if the hash is a blowfish hash.
		if (substr($hash, 0, 4) == '$2a$' || substr($hash, 0, 4) == '$2y$')
		{
			if (version_compare(PHP_VERSION, '5.3.7') >= 0)
			{
				$type = '$2y$';
			}
			else
			{
				$type = '$2a$';
			}

			$hash = $type . substr($hash, 4);

			return (crypt($password, $hash) === $hash);
		}

		// Check if the hash is an MD5 hash.
		if (substr($hash, 0, 3) == '$1$')
		{
			return (crypt($password, $hash) === $hash);
		}

		// Check if the hash is a Joomla hash.
		if (preg_match('#[a-z0-9]{32}:[A-Za-z0-9]{32}#', $hash) === 1)
		{
			return md5($password . substr($hash, 33)) == substr($hash, 0, 32);
		}

		return false;
	}
127685
def _validate_password(self, password):
		""""""
		self.password = password
		if password is None:
			raise errors.AuthError('Missing password')
		keyHash = self.info.get('keyHash', None)
		if keyHash is None and self.password is None:
			return True
		if keyHash is None:
			raise errors.AuthError('Invalid keyHash')
		if self.password is None:
			raise errors.AuthError('Missing password')

		keyHashAlgorithmID = self.info.get('keyHashAlgorithmID','MD5')

		password = self.password.encode('utf8')
		saltHash = self._decode_hex(self.info['salt'])

		keyBasis = password + saltHash
		self.key = self.hash_algo[keyHashAlgorithmID](keyBasis).digest()
		keyHash = self.hash_algo[keyHashAlgorithmID](self.key).hexdigest()

		if not keyHash.upper() == self.info['keyHash'].upper():
			raise errors.AuthError('Invalid Hash')
		return True
389138
@NotNull
    @ObjectiveCName("validatePasswordCommand:")
    public Command<AuthState> validatePassword(String password) {
        return modules.getAuthModule().requestValidatePassword(password);
    }
1201753
public function verifyPasswordHash(string $password, string $hash, string $salt = ''): string
    {
        $password = ($salt ?: self::$salt) . trim($password);

        return password_verify($password, $hash);
    }
1035222
public static function passwordCheck (string $password, string $existingHash) : bool
	{
		// Existing hash contains format and salt at start
		$hash = crypt($password, $existingHash);
		return ($hash == $existingHash) ? TRUE : FALSE;
	}
241653
public boolean isHashValid(String secret) {
		String generatedHash = generateHash(secret);
		return generatedHash.equals(this.hash);
	}
1143931
public static function validate($password, $hash): bool
    {
        return Yii::$app->security->validatePassword($password, $hash);
    }
1150806
public static boolean check(String passwd, String hashed) {
        try {
            String[] parts = hashed.split("\\$");

            if (parts.length != 5 || !parts[1].equals("s0")) {
                throw new IllegalArgumentException("Invalid hashed value");
            }

            long params = Long.parseLong(parts[2], 16);
            byte[] salt = decode(parts[3].toCharArray());
            byte[] derived0 = decode(parts[4].toCharArray());

            int N = (int) Math.pow(2, params >> 16 & 0xffff);
            int r = (int) params >> 8 & 0xff;
            int p = (int) params      & 0xff;

            byte[] derived1 = SCrypt.scrypt(passwd.getBytes("UTF-8"), salt, N, r, p, 32);

            if (derived0.length != derived1.length) return false;

            int result = 0;
            for (int i = 0; i < derived0.length; i++) {
                result |= derived0[i] ^ derived1[i];
            }
            return result == 0;
        } catch (UnsupportedEncodingException e) {
            throw new IllegalStateException("JVM doesn't support UTF-8?");
        } catch (GeneralSecurityException e) {
            throw new IllegalStateException("JVM doesn't support SHA1PRNG or HMAC_SHA256?");
        }
    }
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;
        }
    }