Ejemplo n.º 1
0
        private static int BytesToKey(byte[] bytes)
        {
            ulong Seed   = 97;
            ulong h      = Jenkins.Hash64(bytes, Seed);
            ulong h1     = h >> 48;
            ulong h2     = 3 * (h >> 32);
            ulong h3     = 5 * (h >> 16);
            ulong h4     = 7 * (h & 0xffff);
            int   result = (int)((h1 ^ h2 ^ h3 ^ h4) & 0xffff);

            Trace.TraceInformation("Bytes to key {0}: {1}", BitConverter.ToString(bytes).Replace("-", ""), result);
            return(result);
        }