src/org/kocakosm/pitaya/security/Passwords.java
public static boolean verify(String password, byte[] hash)
	{
		byte[] h = Arrays.copyOf(hash, HASH_LENGTH + SALT_LENGTH + 3);
		int n = 1 << (h[HASH_LENGTH + SALT_LENGTH] & 0xFF);
		int r = h[HASH_LENGTH + SALT_LENGTH + 1] & 0xFF;
		int p = h[HASH_LENGTH + SALT_LENGTH + 2] & 0xFF;
		if (n > N || n < N_MIN || r > R || r < R_MIN || p > P || p < P_MIN) {
			n = N;
			r = R;
			p = P;
		}
		byte[] salt = new byte[SALT_LENGTH];
		System.arraycopy(h, HASH_LENGTH, salt, 0, SALT_LENGTH);
		byte[] expected = hash(password, salt, r, n, p);
		int result = 0;
		for (int i = 0; i < h.length; i++) {
			result |= h[i] ^ expected[i];
		}
		return result == 0;
	}
public static boolean verify(String password, byte[] hash)
	{
		byte[] h = Arrays.copyOf(hash, HASH_LENGTH + SALT_LENGTH + 3);
		int n = 1 << (h[HASH_LENGTH + SALT_LENGTH] & 0xFF);
		int r = h[HASH_LENGTH + SALT_LENGTH + 1] & 0xFF;
		int p = h[HASH_LENGTH + SALT_LENGTH + 2] & 0xFF;
		if (n > N || n < N_MIN || r > R || r < R_MIN || p > P || p < P_MIN) {
			n = N;
			r = R;
			p = P;
		}
		byte[] salt = new byte[SALT_LENGTH];
		System.arraycopy(h, HASH_LENGTH, salt, 0, SALT_LENGTH);
		byte[] expected = hash(password, salt, r, n, p);
		int result = 0;
		for (int i = 0; i < h.length; i++) {
			result |= h[i] ^ expected[i];
		}
		return result == 0;
	}
Verifies that the given password matches the hashed one.

@param password the password to verify.
@param hash the hashed password.

@return whether the given password matches the hashed one.

@throws NullPointerException if one of the arguments is {@code null}.