refactor: use apache commons Hex instead of our own Hexadecimal class
This commit is contained in:
parent
0da0967d8a
commit
1f8a05f189
2 changed files with 2 additions and 16 deletions
src/main/java/land/chipmunk/chipmunkmod/util
|
@ -8,6 +8,7 @@ import land.chipmunk.chipmunkmod.modules.custom_chat.CustomChat;
|
|||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.network.ClientPlayNetworkHandler;
|
||||
import net.minecraft.client.network.ClientPlayerEntity;
|
||||
import org.apache.commons.codec.binary.Hex;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.nio.ByteBuffer;
|
||||
|
@ -85,7 +86,7 @@ public class BotValidationUtilities {
|
|||
String time = String.valueOf(System.currentTimeMillis() / 5_000);
|
||||
String input = client.player.getUuidAsString() + arguments[0] + time + key;
|
||||
byte[] hash = md.digest(input.getBytes(StandardCharsets.UTF_8));
|
||||
String stringHash = Hexadecimal.encode(hash).substring(0, 16);
|
||||
String stringHash = new String(Hex.encodeHex(hash)).substring(0, 16);
|
||||
|
||||
final boolean shouldSectionSign = CustomChat.INSTANCE.enabled && player.hasPermissionLevel(2) && player.isCreative();
|
||||
|
||||
|
|
|
@ -1,15 +0,0 @@
|
|||
package land.chipmunk.chipmunkmod.util;
|
||||
|
||||
public interface Hexadecimal {
|
||||
static String encode (byte b) {
|
||||
return "" + Character.forDigit((b >> 4) & 0xF, 16) + Character.forDigit((b & 0xF), 16);
|
||||
}
|
||||
|
||||
static String encode (byte[] array) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (int i = 0; i < array.length; i++) sb.append(encode(array[i]));
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
// TODO: Decode
|
||||
}
|
Loading…
Add table
Reference in a new issue