public static long hash64()

in src/main/java/org/apache/commons/codec/digest/MurmurHash3.java [1045:1092]


    public static long hash64(final byte[] data, final int offset, final int length, final int seed) {
        // Note: This fails to apply masking using 0xffffffffL to the seed.
        long hash = seed;
        final int nblocks = length >> 3;
        // body
        for (int i = 0; i < nblocks; i++) {
            final int index = offset + (i << 3);
            long k = getLittleEndianLong(data, index);
            // mix functions
            k *= C1;
            k = Long.rotateLeft(k, R1);
            k *= C2;
            hash ^= k;
            hash = Long.rotateLeft(hash, R2) * M + N1;
        }
        // tail
        long k1 = 0;
        final int index = offset + (nblocks << 3);
        switch (offset + length - index) {
        case 7:
            k1 ^= ((long) data[index + 6] & 0xff) << 48;
            // falls-through
        case 6:
            k1 ^= ((long) data[index + 5] & 0xff) << 40;
            // falls-through
        case 5:
            k1 ^= ((long) data[index + 4] & 0xff) << 32;
            // falls-through
        case 4:
            k1 ^= ((long) data[index + 3] & 0xff) << 24;
            // falls-through
        case 3:
            k1 ^= ((long) data[index + 2] & 0xff) << 16;
            // falls-through
        case 2:
            k1 ^= ((long) data[index + 1] & 0xff) << 8;
            // falls-through
        case 1:
            k1 ^= (long) data[index] & 0xff;
            k1 *= C1;
            k1 = Long.rotateLeft(k1, R1);
            k1 *= C2;
            hash ^= k1;
        }
        // finalization
        hash ^= length;
        return fmix64(hash);
    }