aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/net/elytrium/limboauth
diff options
context:
space:
mode:
authorPetr Ilin <hevav@hevav.dev>2022-07-01 03:16:07 +0300
committerPetr Ilin <hevav@hevav.dev>2022-07-01 03:16:07 +0300
commit4cfd89471225cbdb47ad0d6999646013932380d4 (patch)
tree5ff1060dbd68403015a4e9e42c8a76aa0b00bade /src/main/java/net/elytrium/limboauth
parent23f6763f330290b8d58d42133b9c4890ef1f4173 (diff)
downloadLimboAuth-4cfd89471225cbdb47ad0d6999646013932380d4.tar.gz
LimboAuth-4cfd89471225cbdb47ad0d6999646013932380d4.tar.bz2
LimboAuth-4cfd89471225cbdb47ad0d6999646013932380d4.zip
SHA512_P_REVERSED_HASH migration-hash
Diffstat (limited to 'src/main/java/net/elytrium/limboauth')
-rw-r--r--src/main/java/net/elytrium/limboauth/Settings.java1
-rw-r--r--src/main/java/net/elytrium/limboauth/migration/MigrationHash.java4
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 775976f..23b7215 100644
--- a/src/main/java/net/elytrium/limboauth/Settings.java
+++ b/src/main/java/net/elytrium/limboauth/Settings.java
@@ -98,6 +98,7 @@ public class Settings extends YamlConfig {
"MOON_SHA256 - Moon SHA256(SHA256(password)) that looks like $SHA$hash (no salt)",
"SHA256_NO_SALT - SHA256(password) that looks like $SHA$hash (NexAuth)",
"SHA512_NO_SALT - SHA512(password) that looks like $SHA$hash (NexAuth)",
+ "SHA512_P_REVERSED_HASH - SHA512(password) that looks like $SHA$hash$salt (nLogin)",
})
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 5f6cb71..ba20655 100644
--- a/src/main/java/net/elytrium/limboauth/migration/MigrationHash.java
+++ b/src/main/java/net/elytrium/limboauth/migration/MigrationHash.java
@@ -69,6 +69,10 @@ public enum MigrationHash {
SHA512_NO_SALT((hash, password) -> {
String[] args = hash.split("\\$"); // $SHA$hash
return args.length == 3 && args[2].equals(getDigest(password, "SHA-512"));
+ }),
+ SHA512_P_REVERSED_HASH((hash, password) -> {
+ String[] args = hash.split("\\$"); // $SHA$hash$salt
+ return args.length == 4 && args[2].equals(getDigest(password + args[3], "SHA-512"));
});
private final MigrationHashVerifier verifier;