Java Utililty Methods Hash Calculate

List of utility methods to do Hash Calculate

Description

The list of methods to do Hash Calculate are organized into topic(s).

Method

inthash(Object[] array)
hash
int hash = 0;
for (int i = 0; i < array.length; ++i) {
    Object o = array[i];
    hash = combine(hash, hash(o));
return hash;
inthash(Object[] state)
hash
int hash = 0;
for (int i = 0; i < state.length; ++i) {
    hash = hash * 31 + (null == state[i] ? 0 : state[i].hashCode());
return hash;
inthash1(int val)
hash
val = (val + 0x7ed55d16) + (val << 12);
val = (val ^ 0xc761c23c) ^ (val >> 19);
val = (val + 0x165667b1) + (val << 5);
val = (val + 0xd3a2646c) ^ (val << 9);
val = (val + 0xfd7046c5) + (val << 3);
val = (val ^ 0xb55a4f09) ^ (val >> 16);
return val;
inthash1(Object a)
hash
return a != null ? a.hashCode() : 0;
inthash16(int hash)
hash
return hash & 0xffff ^ hash >>> 16;
inthash3(int hash, Object x, Object y, Object z)
Utility method to combine a base hash with the identity hash of one or more objects.
return 0x30000000 | (hash + 7 * System.identityHashCode(x) + 11 * System.identityHashCode(y)
        + 13 * System.identityHashCode(z));
intHash32(byte[] v, int iStart, int iLength)
Hash
int u = 0x326F637B;
if (v == null) {
    assert false;
    return u;
if (iStart < 0) {
    assert false;
    return u;
...
inthash32shiftmult(int k)
hashshiftmult
k = (k ^ 61) ^ (k >>> 16);
k = k + (k << 3);
k = k ^ (k >>> 4);
k = k * 0x27d4eb2d;
k = k ^ (k >>> 15);
return k;
longhash64(final byte[] data, int length)
hash
return hash64(data, length, 0xe17a1465);
inthash64To32(long lg)
hash To
return (int) (lg ^ (lg >>> 32));