Exemplo n.º 1
0
        public int Hash() //Функция нахождения хеш-образа
        {
            hash = h0;

            foreach (var ch in mes.Substring(0))
            {
                int charIndex;
                if (Alphabet.GetCharCode(ch) >= 192 && Alphabet.GetCharCode(ch) <= 223)
                {
                    charIndex = Alphabet.GetCharCode(ch) - 191;
                }
                else if (Alphabet.GetCharCode(ch) >= 224 && Alphabet.GetCharCode(ch) <= 255)
                {
                    charIndex = Alphabet.GetCharCode(ch) - 223;
                }
                else
                {
                    throw new Exception($"Недопустимое значение!");
                }
                hash = func(hash, charIndex);
                Console.WriteLine(hash);
            }
            return(hash); //Хеш
        }