From 146b5fa741ca9fd589eb08402e4918bfffe3e13a Mon Sep 17 00:00:00 2001 From: Petr Ilin Date: Mon, 28 Mar 2022 13:17:53 +0300 Subject: DBA SHA512 migration hash algorithm --- src/main/java/net/elytrium/limboauth/Settings.java | 1 + src/main/java/net/elytrium/limboauth/migration/MigrationHash.java | 4 ++++ 2 files changed, 5 insertions(+) (limited to 'src/main') 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")); -- cgit