Fix hbot authentication

This commit is contained in:
7cc5c4f330d47060 2024-09-23 00:13:05 -04:00
parent 2a5c2c2718
commit 0560bd9673
Signed by: 7cc5c4f330d47060
SSH key fingerprint: SHA256:e+4tcZut1nBpe10PqjaO+Rvie0Q7W4qIvFzcUw+7riA

View file

@ -29,7 +29,7 @@ public class BotValidationUtilities {
try {
MessageDigest md = MessageDigest.getInstance("SHA-256");
String time = String.valueOf(System.currentTimeMillis() / 10000);
String input = prefix + command.replaceAll("&[0-9a-fklmnor]", "") + ";" + client.player.getName() + ";" + time + ";" + key;
String input = prefix + command.replaceAll("&[0-9a-fklmnor]", "") + ";" + client.player.getName().getString() + ";" + time + ";" + key;
byte[] hash = md.digest(input.getBytes(StandardCharsets.UTF_8));
BigInteger bigInt = new BigInteger(1, Arrays.copyOfRange(hash, 0, 4));
String stringHash = bigInt.toString(Character.MAX_RADIX);