Example #1
0
        /// <summary>
        /// Compute the hash value associate with the key
        /// </summary>
        /// <param name="key">key from the original key set</param>
        /// <returns>Hash value (0 &gt; hash &gt; N)</returns>
        public uint Search(byte[] key)
        {
            var hl = new uint[3];

            JenkinsHash.HashVector(_hashSeed, key, hl);
            var g = hl[0] % _nbuckets;
            var f = hl[1] % _n;
            var h = hl[2] % (_n - 1) + 1;

            var disp      = _cs.Query(g);
            var probe0Num = disp % _n;
            var probe1Num = disp / _n;
            var position  = (uint)((f + ((ulong)h) * probe0Num + probe1Num) % _n);

            return(position);
        }