CrazyCrypt fix - UTF-8 !
This commit is contained in:
parent
2c480738ef
commit
1c77a1d0d9
@ -12,16 +12,13 @@ public class CRAZYCRYPT1 implements EncryptionMethod {
|
|||||||
@Override
|
@Override
|
||||||
public String getHash(String password, String salt, String name)
|
public String getHash(String password, String salt, String name)
|
||||||
throws NoSuchAlgorithmException {
|
throws NoSuchAlgorithmException {
|
||||||
final String text = "ÜÄaeut//&/=I " + password + "7421€547" + name + "__+IÄIH§%NK " + password;
|
final String text = "ÜÄaeut//&/=I " + password + "7421€547" + name + "__+IÄIH§%NK " + password;
|
||||||
try
|
try {
|
||||||
{
|
final MessageDigest md = MessageDigest.getInstance("SHA-512");
|
||||||
final MessageDigest md = MessageDigest.getInstance("SHA-512");
|
md.update(text.getBytes(charset), 0, text.length());
|
||||||
md.update(text.getBytes(charset), 0, text.length());
|
return byteArrayToHexString(md.digest());
|
||||||
return byteArrayToHexString(md.digest());
|
} catch (final NoSuchAlgorithmException e) {
|
||||||
}
|
return null;
|
||||||
catch (final NoSuchAlgorithmException e)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -31,8 +28,7 @@ public class CRAZYCRYPT1 implements EncryptionMethod {
|
|||||||
return hash.equals(getHash(password, null, playerName));
|
return hash.equals(getHash(password, null, playerName));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String byteArrayToHexString(final byte... args)
|
public static String byteArrayToHexString(final byte... args) {
|
||||||
{
|
|
||||||
final char[] chars = new char[args.length * 2];
|
final char[] chars = new char[args.length * 2];
|
||||||
for (int i = 0; i < args.length; i++) {
|
for (int i = 0; i < args.length; i++) {
|
||||||
chars[i * 2] = CRYPTCHARS[(args[i] >> 4) & 0xF];
|
chars[i * 2] = CRYPTCHARS[(args[i] >> 4) & 0xF];
|
||||||
@ -40,5 +36,4 @@ public class CRAZYCRYPT1 implements EncryptionMethod {
|
|||||||
}
|
}
|
||||||
return new String(chars);
|
return new String(chars);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
|
||||||
Loading…
x
Reference in New Issue
Block a user