diff options
author | Petr Ilin <hevav@hevav.dev> | 2022-03-28 13:17:53 +0300 |
---|---|---|
committer | Petr Ilin <hevav@hevav.dev> | 2022-03-28 13:17:53 +0300 |
commit | 146b5fa741ca9fd589eb08402e4918bfffe3e13a (patch) | |
tree | fb2bc41b9f66b4ca36b44c8e0a9fdbe3f9dc54bf /src/main/java/net | |
parent | 334bcd43152c2650365b79813ffc4e4f4d4ae16b (diff) | |
download | LimboAuth-146b5fa741ca9fd589eb08402e4918bfffe3e13a.tar.gz LimboAuth-146b5fa741ca9fd589eb08402e4918bfffe3e13a.tar.bz2 LimboAuth-146b5fa741ca9fd589eb08402e4918bfffe3e13a.zip |
DBA SHA512 migration hash algorithm
Diffstat (limited to 'src/main/java/net')
-rw-r--r-- | src/main/java/net/elytrium/limboauth/Settings.java | 1 | ||||
-rw-r--r-- | src/main/java/net/elytrium/limboauth/migration/MigrationHash.java | 4 |
2 files changed, 5 insertions, 0 deletions
diff --git a/src/main/java/net/elytrium/limboauth/Settings.java b/src/main/java/net/elytrium/limboauth/Settings.java index f584e21..bc1bae4 100644 --- a/src/main/java/net/elytrium/limboauth/Settings.java +++ b/src/main/java/net/elytrium/limboauth/Settings.java @@ -80,6 +80,7 @@ public class Settings extends Config { "SHA256_P - SHA256(password) that looks like $SHA$salt$hash", "SHA512_NP - SHA512(password) that looks like SHA$salt$hash", "SHA512_P - SHA512(password) that looks like $SHA$salt$hash", + "SHA512_DBA - DBA plugin SHA512(SHA512(password) + salt) that looks like SHA$salt$hash", "MD5 - Basic md5 hash", "Argon2 - Argon2 hash that looks like $argon2i$v=1234$m=1234,t=1234,p=1234$hash", }) diff --git a/src/main/java/net/elytrium/limboauth/migration/MigrationHash.java b/src/main/java/net/elytrium/limboauth/migration/MigrationHash.java index 4f7ae24..a93f231 100644 --- a/src/main/java/net/elytrium/limboauth/migration/MigrationHash.java +++ b/src/main/java/net/elytrium/limboauth/migration/MigrationHash.java @@ -32,6 +32,10 @@ public enum MigrationHash { && arr[3].equals(MigrationHash.getDigest(MigrationHash.getDigest(password, "SHA-256") + arr[2], "SHA-256")); }), ARGON2(new Argon2Verifier()), + SHA512_DBA((hash, password) -> { + String[] arr = hash.split("\\$"); // SHA$salt$hash + return arr.length == 3 && arr[2].equals(MigrationHash.getDigest(MigrationHash.getDigest(password, "SHA-512") + arr[1], "SHA-512")); + }), SHA512_NP((hash, password) -> { String[] arr = hash.split("\\$"); // SHA$salt$hash return arr.length == 3 && arr[2].equals(MigrationHash.getDigest(password + arr[1], "SHA-512")); |