public static int hashCode(ByteBuffer buf, int offset, int length) {
        int hash = 1;
        for (int i = offset; i < offset + length; i++) {
            hash = (31 * hash) + (int) toByte(buf, i);
        }
        return hash;
    }
ByteBuffer to hash offset to start from length to hash
stroom-bytebuffer/src/main/java/stroom/bytebuffer/hbase/ByteBufferUtils.java