From 1c77a1d0d9db16623a808f3b41ddee5461adcfce Mon Sep 17 00:00:00 2001 From: Xephi Date: Sun, 15 Jun 2014 00:16:05 +0200 Subject: [PATCH] CrazyCrypt fix - UTF-8 ! --- .../authme/security/crypts/CRAZYCRYPT1.java | 23 ++++++++----------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/src/main/java/fr/xephi/authme/security/crypts/CRAZYCRYPT1.java b/src/main/java/fr/xephi/authme/security/crypts/CRAZYCRYPT1.java index 8bd4d83bd..109c7701c 100644 --- a/src/main/java/fr/xephi/authme/security/crypts/CRAZYCRYPT1.java +++ b/src/main/java/fr/xephi/authme/security/crypts/CRAZYCRYPT1.java @@ -12,16 +12,13 @@ public class CRAZYCRYPT1 implements EncryptionMethod { @Override public String getHash(String password, String salt, String name) throws NoSuchAlgorithmException { - final String text = "ÜÄaeut//&/=I " + password + "7421€547" + name + "__+IÄIH§%NK " + password; - try - { - final MessageDigest md = MessageDigest.getInstance("SHA-512"); - md.update(text.getBytes(charset), 0, text.length()); - return byteArrayToHexString(md.digest()); - } - catch (final NoSuchAlgorithmException e) - { - return null; + final String text = "ÜÄaeut//&/=I " + password + "7421€547" + name + "__+IÄIH§%NK " + password; + try { + final MessageDigest md = MessageDigest.getInstance("SHA-512"); + md.update(text.getBytes(charset), 0, text.length()); + return byteArrayToHexString(md.digest()); + } catch (final NoSuchAlgorithmException e) { + return null; } } @@ -31,8 +28,7 @@ public class CRAZYCRYPT1 implements EncryptionMethod { 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]; for (int i = 0; i < args.length; i++) { chars[i * 2] = CRYPTCHARS[(args[i] >> 4) & 0xF]; @@ -40,5 +36,4 @@ public class CRAZYCRYPT1 implements EncryptionMethod { } return new String(chars); } - -} +} \ No newline at end of file