示例#1
0
        public int Fnv1()
        {
            int a = 0;

            if (TestType == Types.ShortSentence)
            {
                for (int i = 0; i < _sentences.GetLength(0); i++)
                {
                    _fnv1.ComputeHash(_sentences[i]);
                    a++;
                }
            }
            if (TestType == Types.Word)
            {
                for (int i = 0; i < _words.GetLength(0); i++)
                {
                    _fnv1.ComputeHash(_words[i]);
                    a++;
                }
            }
            if (TestType == Types.LongText)
            {
                _fnv1.ComputeHash(_longText);
            }
            return(a);
        }
示例#2
0
        public ConnectionId(byte[] connectionIdBytes)
        {
            if (connectionIdBytes.Length > 18)
            {
                throw new Exception();
            }

            ConnectionIdBytes = connectionIdBytes;

            if (ConnectionIdBytes.Length == 0)
            {
                HashCode   = 0;
                LengthByte = 0;
            }
            else
            {
                HashCode   = Hasher.ComputeHash(connectionIdBytes).Hash.ToInt32(true);
                LengthByte = (byte)(connectionIdBytes.Length - 3);
            }
        }