コード例 #1
0
        public bool testBytes(byte[] val, int offset, int length)
        {
            long hash64 = val == null ? Murmur3.NULL_HASHCODE
                : Murmur3.hash64(val, offset, length);

            return(testHash((ulong)hash64));
        }
コード例 #2
0
        public void addBytes(byte[] val, int offset, int length)
        {
            // We use the trick mentioned in "Less Hashing, Same Performance: Building a Better Bloom Filter"
            // by Kirsch et.al. From abstract 'only two hash functions are necessary to effectively
            // implement a Bloom filter without any loss in the asymptotic false positive probability'

            // Lets split up 64-bit hashcode into two 32-bit hash codes and employ the technique mentioned
            // in the above paper
            long hash64 = val == null ? Murmur3.NULL_HASHCODE
                : Murmur3.hash64(val, offset, length);

            addHash((ulong)hash64);
        }