Closed technical-customs closed 4 years ago
Please share the code for creating the hash and verifying it.
Hashes are salted and thus will always produce a different String, which is why you cannot compare them using String.equals, you have to use the Argon2.verify method. Try the following code from the README.md:
Argon2 argon2 = Argon2Factory.create();
char[] password = "abc12345".toCharArray();
try {
String hash = argon2.hash(10, 65536, 1, password);
if (argon2.verify(hash, password)) {
System.out.println("matches")
} else {
System.out.println("error");
}
} finally {
argon2.wipeArray(password);
}
Got it to work. Thanks.
Thanks for the help, @Gatgeagent :)
Can't seem to get verify to work or any other compares based on the algorithm producing different hashes with the same configuration and same string.