Consolidate HexTool methods and add more tests

This commit is contained in:
P0nk
2022-02-14 19:05:50 +01:00
parent 1daddbf302
commit 084e7b22fa
8 changed files with 61 additions and 41 deletions

View File

@@ -1335,7 +1335,7 @@ public class Client extends ChannelInboundHandlerAdapter {
try {
MessageDigest digester = MessageDigest.getInstance(type);
digester.update(password.getBytes(StandardCharsets.UTF_8), 0, password.length());
return HexTool.toString(digester.digest()).replace(" ", "").toLowerCase().equals(hash);
return HexTool.toHexString(digester.digest()).replace(" ", "").toLowerCase().equals(hash);
} catch (NoSuchAlgorithmException e) {
throw new RuntimeException("Encoding the string failed", e);
}