diff options
author | mdxd44 <ogurec332@mail.ru> | 2022-05-20 03:02:28 +0900 |
---|---|---|
committer | mdxd44 <ogurec332@mail.ru> | 2022-05-20 03:02:28 +0900 |
commit | 903fd1e1d86cdd70eddf300e3370cad0cd7d538b (patch) | |
tree | 16465aac8a009538fd6d957ac3b12bf56ccd540c /src/main/java | |
parent | 85b5811d3f71928f6f243e039a8bf112c0142b12 (diff) | |
download | LimboAuth-903fd1e1d86cdd70eddf300e3370cad0cd7d538b.tar.gz LimboAuth-903fd1e1d86cdd70eddf300e3370cad0cd7d538b.tar.bz2 LimboAuth-903fd1e1d86cdd70eddf300e3370cad0cd7d538b.zip |
Don't initialize argon2 on startup.
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/net/elytrium/limboauth/migration/MigrationHash.java | 8 |
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)); } } |