From 0b79ceba393e0b592fa12d0c1be98a5b403965f9 Mon Sep 17 00:00:00 2001 From: Petr Ilin Date: Fri, 1 Apr 2022 00:27:29 +0300 Subject: More migration hashes --- src/main/java/net/elytrium/limboauth/Settings.java | 8 +++++--- src/main/java/net/elytrium/limboauth/migration/MigrationHash.java | 5 +++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/main/java/net/elytrium/limboauth/Settings.java b/src/main/java/net/elytrium/limboauth/Settings.java index bc1bae4..745a6ee 100644 --- a/src/main/java/net/elytrium/limboauth/Settings.java +++ b/src/main/java/net/elytrium/limboauth/Settings.java @@ -75,14 +75,16 @@ public class Settings extends Config { @Comment({ "If you want to migrate your database from another plugin, which is not using BCrypt.", "You can set an old hash algorithm to migrate from.", - "AUTHME - AuthMe SHA256(SHA256(password) + salt) that looks like $SHA$salt$hash", + "AUTHME - AuthMe SHA256(SHA256(password) + salt) that looks like $SHA$salt$hash (AuthMe, MoonVKAuth, DSKAuth, DBA)", + "AUTHME_NP - AuthMe SHA256(SHA256(password) + salt) that looks like SHA$salt$hash (JPremium)", "SHA256_NP - SHA256(password) that looks like SHA$salt$hash", "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", + "SHA512_DBA - DBA plugin SHA512(SHA512(password) + salt) that looks like SHA$salt$hash (DBA, JPremium)", "MD5 - Basic md5 hash", - "Argon2 - Argon2 hash that looks like $argon2i$v=1234$m=1234,t=1234,p=1234$hash", + "ARGON2 - Argon2 hash that looks like $argon2i$v=1234$m=1234,t=1234,p=1234$hash", + "MOON_SHA256 - Moon SHA256(SHA256(password)) that looks like $SHA$hash (no salt)", }) public String MIGRATION_HASH = ""; @Comment("Available dimensions: OVERWORLD, NETHER, THE_END") diff --git a/src/main/java/net/elytrium/limboauth/migration/MigrationHash.java b/src/main/java/net/elytrium/limboauth/migration/MigrationHash.java index 3894507..3110a2a 100644 --- a/src/main/java/net/elytrium/limboauth/migration/MigrationHash.java +++ b/src/main/java/net/elytrium/limboauth/migration/MigrationHash.java @@ -31,6 +31,11 @@ public enum MigrationHash { return arr.length == 4 && arr[3].equals(MigrationHash.getDigest(MigrationHash.getDigest(password, "SHA-256") + arr[2], "SHA-256")); }), + AUTHME_NP((hash, password) -> { + String[] arr = hash.split("\\$"); // SHA$salt$hash + return arr.length == 3 + && arr[2].equals(MigrationHash.getDigest(MigrationHash.getDigest(password, "SHA-256") + arr[1], "SHA-256")); + }), ARGON2(new Argon2Verifier()), SHA512_DBA((hash, password) -> { String[] arr = hash.split("\\$"); // SHA$salt$hash -- cgit