mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-18 11:19:19 +00:00
Fix flugel tiara's secret code not working on linux
This commit is contained in:
1 parent
71bc77e406
commit
078fd054e0
1 file changed
+5
-7
@@ -21,7 +21,7 @@ public final class StringObfuscator {
|
||||
return getHash(str).equals(hash);
|
||||
}
|
||||
|
||||
public static String getHash(String str) {
|
||||
private static String getHash(String str) {
|
||||
if(str != null)
|
||||
try {
|
||||
MessageDigest md = MessageDigest.getInstance("SHA-256");
|
||||
@@ -32,9 +32,10 @@ public final class StringObfuscator {
|
||||
return "";
|
||||
}
|
||||
|
||||
private static String dontRainbowTableMeOrMySonEverAgain(String str) {
|
||||
private static String dontRainbowTableMeOrMySonEverAgain(String str) throws NoSuchAlgorithmException {
|
||||
str += reverseString(str);
|
||||
SecureRandom rand = new SecureRandom(str.getBytes());
|
||||
SecureRandom rand = SecureRandom.getInstance("SHA1PRNG");
|
||||
rand.setSeed(str.getBytes());
|
||||
int l = str.length();
|
||||
int steps = rand.nextInt(l);
|
||||
char[] chrs = str.toCharArray();
|
||||
@@ -52,10 +53,7 @@ public final class StringObfuscator {
|
||||
}
|
||||
|
||||
private static String reverseString(String str) {
|
||||
char[] chars = new char[str.length()];
|
||||
for(int i = 0; i < chars.length; i++)
|
||||
chars[i] = str.charAt(str.length() - 1 - i);
|
||||
return String.copyValueOf(chars);
|
||||
return new StringBuilder(str).reverse().toString();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user