List of utility methods to do Hash Calculate
int | hashFNV32(int val) 32 bit FNV hash. int hashVal = FNV_OFFSET_BASIS_32; for (int i = 0; i < 4; i++) { int octet = val & 0x00ff; val = val >> 8; hashVal = hashVal ^ octet; hashVal = hashVal * FNV_PRIME_32; return Math.abs(hashVal); ... |
long | hashFNV64(byte[] bytes) FNV hashes are designed to be fast while maintaining a low collision rate. long nHashVal = 0xcbf29ce484222325L; long nMagicPrime = 0x00000100000001b3L; for (int i = 0; i < bytes.length; i++) { nHashVal ^= bytes[i]; nHashVal *= nMagicPrime; return nHashVal; |
int | hashForEqual(Class clazz) hash For Equal return hashForEqual(clazz.getName());
|
int | hashHC(int i) hash HC return (i * -1640531535) >>> ((MIN_MATCH * 8) - HASH_LOG_HC);
|
int | hashHsieh(int init, Object... vals) hash Hsieh if (vals == null || vals.length == 0) { return init; int hash = init; for (final Object o : vals) { final int thingHash = o.hashCode(); hash += (thingHash >>> 16); final int tmp = ((thingHash & 0xffff) << 11) ^ hash; ... |
int | hashInt(final int v) Quickly mixes the bits of an integer. final int h = v * INT_PHI; return h ^ (h >>> 16); |
int | hashIntArray(int seed, int[] data, int offset, int len) hash Int Array int h1 = seed; int off = offset; int end = offset + len; while (off < end) { int k1 = data[off++]; k1 *= 0xcc9e2d51; k1 = Integer.rotateLeft(k1, 15); k1 *= 0x1b873593; ... |
int | hashIt(Object o) Return an object's hash code or 0 if the object is if (o == null) return 0; else return o.hashCode(); |
int | hashJava32(byte[] byteList) This is a copy of the hash function in JDK 1.6 to ensure it does not change. if (byteList == null) { return 0; long hash = 1; for (int i = 0; i < byteList.length; i++) { byte element = byteList[i]; hash = 31 * hash + element; return (int) hash & BITMASK_POSITIVE_32; |
long | hashJava64(byte[] byteList) hash Java if (byteList == null) { return 0; long hash = 1; for (byte element : byteList) { hash = 31 * hash + element; return hash & BITMASK_POSITIVE_64; ... |