@Test
public void testArgon2FailedHash() throws InterruptedException {
String failedSecret = "fourty two";
String failedHash = "$argon2i$v=19$m=65536,t=12,p=1$uySzYkfINQ1sDU4WZJ+D4Q$DSYZB1XQAmPLyMJi+7aWjqEfpagRO5zAEIvOlJzKRPU";
AtomicInteger counter = new AtomicInteger(0);
AtomicInteger failedCounter = new AtomicInteger(0);
ExecutorService executor = Executors.newFixedThreadPool(4);
Runnable verificationTask = () -> {
boolean same = passwordHasher.compare(failedSecret.toCharArray(), failedHash);
if (!same) {
failedCounter.incrementAndGet();
}
counter.incrementAndGet();
};
for (int i = 0; i < 10000; i++) {
executor.execute(verificationTask);
}
executor.shutdown();
executor.awaitTermination(2, TimeUnit.MINUTES);
int counted = failedCounter.get();
assertEquals("Hashing failed " + counted + " of " + counter.get() + " times", 0, counted);
}
This test fails on my Ubuntu server regularly but not on my windows 10 machine. In average 1 of 300 times the hash is not verified correctly. I already tested the memory with memtester without any problem. Any idea what is going wrong on my server?
I am facing a similar problem as in: https://github.com/phxql/argon2-jvm/issues/46
This test fails on my Ubuntu server regularly but not on my windows 10 machine. In average 1 of 300 times the hash is not verified correctly. I already tested the memory with memtester without any problem. Any idea what is going wrong on my server?