From 99a4a6741ac49308410f40695048f216a3ee15d3 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Fri, 16 Oct 2026 14:52:46 -0400 Subject: [PATCH] Remove unused StringUtils.hashString and FastMath.hash Neither matches the client string hash; Hasher.SBStringHash does. Co-Authored-By: Claude Opus 5.5 --- src/engine/math/FastMath.java | 30 ----------------- src/engine/util/StringUtils.java | 57 -------------------------------- 2 files changed, 87 deletions(-) diff --git a/src/engine/math/FastMath.java b/src/engine/math/FastMath.java index c389d595..be3478f9 100644 --- a/src/engine/math/FastMath.java +++ b/src/engine/math/FastMath.java @@ -583,36 +583,6 @@ final public class FastMath { return ret.normalize(); } - /** - * Turns a String into an Integer hash that the client will recognize. - * - * @param s The String to hash - * @return the Integer hash - */ - public static int hash(String s) { - int out = 0, pad = 0; - for (char c : s.toCharArray()) { - if (c == ' ' || c == '\\') { - pad += 5; - continue; - } - if (c > 0x40 && c < 0x60) - out ^= _rotl((byte) 0x60, pad); - out ^= _rotl((byte) (c & 0xDF), pad); - pad += 5; - } - return out; - } - - /** - * Utility function for making hashes - */ - private static int _rotl(int value, int shift) { - if ((shift &= 31) == 0) - return value; - return (value << shift) | (value >> (32 - shift)); - } - /** * Gets number of seconds until next hours */ diff --git a/src/engine/util/StringUtils.java b/src/engine/util/StringUtils.java index b6ffda16..be890ec0 100644 --- a/src/engine/util/StringUtils.java +++ b/src/engine/util/StringUtils.java @@ -57,63 +57,6 @@ public class StringUtils { return Long.toHexString(l).toUpperCase(); } - // Well done IDA Pro. - - public static int hashString(String toHash) { - byte[] hashArray = toHash.getBytes(); - int hash = 0; - int shift = 0; - if (hashArray.length == 8 || hashArray.length == 7) { - int ecx = 0; - if (hashArray.length == 8) { - ecx = hashArray[7]; - } - int eax = hashArray[4]; - int esi = ecx * 0x8; - eax ^= esi; - ecx ^= 0x5A0; - esi = hashArray[5]; - eax <<= 4; - eax ^= esi; - esi = hashArray[6]; - eax <<= 4; - eax ^= esi; - esi = hashArray[2]; - eax <<= 5; - eax ^= esi; - esi = hashArray[1]; - int edx = hashArray[0]; - eax <<= 5; - eax ^= esi; - ecx /= 2; - ecx /= 2; - eax <<= 5; - ecx ^= edx; - eax ^= ecx; - return eax; - } else { - - for (int i = 0; i < hashArray.length; i++) { - if (i == 0) - shift = 0; - else - shift += 5; - int toShift = hashArray[i] - 0x20; - int shifted = (toShift << shift); - hash ^= shifted; - if (shift > 24) { - int newShift = 0x20 - shift; - int newShifted = toShift >> newShift; - hash ^= newShifted; - if (shift > 27) { - shift -= 0x20; - } - } - } - return hash; - } - } - public static String wordWrap(String text, int LineWidth) { StringTokenizer st = new StringTokenizer(text); int SpaceLeft = LineWidth;