diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/auth/password/DigestPasswordVerifier.java b/LaunchServer/src/main/java/pro/gravit/launchserver/auth/password/DigestPasswordVerifier.java index 7d3e0ea5..abca8a42 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/auth/password/DigestPasswordVerifier.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/auth/password/DigestPasswordVerifier.java @@ -18,7 +18,7 @@ public boolean check(String encryptedPassword, String password) { try { MessageDigest digest = MessageDigest.getInstance(algo); byte[] bytes = SecurityHelper.fromHex(encryptedPassword); - return Arrays.equals(password.getBytes(StandardCharsets.UTF_8), digest.digest(bytes)); + return Arrays.equals(bytes, digest.digest(password.getBytes(StandardCharsets.UTF_8))); } catch (NoSuchAlgorithmException e) { logger.error("Digest algorithm {} not supported", algo); return false; diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/auth/password/DoubleDigestPasswordVerifier.java b/LaunchServer/src/main/java/pro/gravit/launchserver/auth/password/DoubleDigestPasswordVerifier.java index cc8bb5dd..071664fd 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/auth/password/DoubleDigestPasswordVerifier.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/auth/password/DoubleDigestPasswordVerifier.java @@ -18,9 +18,9 @@ public class DoubleDigestPasswordVerifier extends PasswordVerifier { public boolean check(String encryptedPassword, String password) { try { MessageDigest digest = MessageDigest.getInstance(algo); - byte[] bytes = SecurityHelper.fromHex(encryptedPassword); + byte[] bytes = SecurityHelper.fromHex(password); byte[] firstDigest = digest.digest(bytes); - return Arrays.equals(password.getBytes(StandardCharsets.UTF_8), toHexMode ? digest.digest(SecurityHelper.toHex(firstDigest).getBytes(StandardCharsets.UTF_8)) : digest.digest(firstDigest)); + return Arrays.equals(encryptedPassword.getBytes(StandardCharsets.UTF_8), toHexMode ? digest.digest(SecurityHelper.toHex(firstDigest).getBytes(StandardCharsets.UTF_8)) : digest.digest(firstDigest)); } catch (NoSuchAlgorithmException e) { logger.error("Digest algorithm {} not supported", algo); return false;