aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/net/elytrium/limboauth/migration/MigrationHash.java8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/main/java/net/elytrium/limboauth/migration/MigrationHash.java b/src/main/java/net/elytrium/limboauth/migration/MigrationHash.java
index 8707a88..5f6cb71 100644
--- a/src/main/java/net/elytrium/limboauth/migration/MigrationHash.java
+++ b/src/main/java/net/elytrium/limboauth/migration/MigrationHash.java
@@ -23,6 +23,7 @@ import java.nio.charset.StandardCharsets;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import org.apache.commons.codec.binary.Hex;
+import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
@SuppressWarnings("unused")
public enum MigrationHash {
@@ -93,10 +94,15 @@ public enum MigrationHash {
private static class Argon2Verifier implements MigrationHashVerifier {
- private final Argon2 argon2 = Argon2Factory.create();
+ @MonotonicNonNull
+ private Argon2 argon2;
@Override
public boolean checkPassword(String hash, String password) {
+ if (this.argon2 == null) {
+ this.argon2 = Argon2Factory.create();
+ }
+
return this.argon2.verify(hash, password.getBytes(StandardCharsets.UTF_8));
}
}