public static int hash32()

in src/main/java/org/apache/commons/codec/digest/MurmurHash2.java [119:153]


    public static int hash32(final byte[] data, final int length, final int seed) {
        // Initialize the hash to a random value
        int h = seed ^ length;
        // Mix 4 bytes at a time into the hash
        final int nblocks = length >> 2;
        // body
        for (int i = 0; i < nblocks; i++) {
            final int index = i << 2;
            int k = getLittleEndianInt(data, index);
            k *= M32;
            k ^= k >>> R32;
            k *= M32;
            h *= M32;
            h ^= k;
        }
        // Handle the last few bytes of the input array
        final int index = nblocks << 2;
        switch (length - index) {
        case 3:
            h ^= (data[index + 2] & 0xff) << 16;
            // falls-through
        case 2:
            h ^= (data[index + 1] & 0xff) << 8;
            // falls-through
        case 1:
            h ^= data[index] & 0xff;
            h *= M32;
        }
        // Do a few final mixes of the hash to ensure the last few
        // bytes are well-incorporated.
        h ^= h >>> 13;
        h *= M32;
        h ^= h >>> 15;
        return h;
    }