mirror of
https://code.chipmunk.land/ChomeNS/chipmunkmod.git
synced 2025-11-13 16:16:38 +00:00
refactor: update chomens bot hashing
This commit is contained in:
parent
8ab48747c3
commit
ac59928566
1 changed files with 7 additions and 1 deletions
|
|
@ -84,9 +84,15 @@ public class BotValidationUtilities {
|
|||
try {
|
||||
final String[] arguments = command.split(" ");
|
||||
|
||||
final String trimmedInput = String.join(" ", arguments).trim();
|
||||
final String[] splitInput = trimmedInput.contains("\n")
|
||||
? trimmedInput.split(" ")
|
||||
: trimmedInput.split("\\s+");
|
||||
final String joinedSplitInput = String.join(" ", splitInput);
|
||||
|
||||
final MessageDigest md = MessageDigest.getInstance("SHA-256");
|
||||
final String time = String.valueOf(System.currentTimeMillis() / 5_000);
|
||||
final String input = client.player.getUuidAsString() + arguments[0] + time + key;
|
||||
final String input = client.player.getUuidAsString() + joinedSplitInput + time + key;
|
||||
final byte[] hash = md.digest(input.getBytes(StandardCharsets.UTF_8));
|
||||
String stringHash = new String(Hex.encodeHex(hash)).substring(0, 16);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue