static void Main(string[] args)
        {
            var        dict      = File.ReadAllLines($"../../../dictionary.txt");
            Encryption encryptor = new Encryption("6", ' ', 'z', false);
            string     text      = encryptor.Decrypt("W6#*.+$/w'6w..$./w)/B6yw'' z6o -");
            KMP        kmp       = new KMP(text);
            int        c         = 0;

            for (int i = 0; i < dict.Length; i++)
            {
                c += kmp.Match(dict[i]);
            }
            //Console.WriteLine(c);
            double aa = 50;
            int    bb = 1000;

            Console.WriteLine(aa / bb);
        }
예제 #2
0
        public string Solve(string cipher)
        {
            var        dict = File.ReadAllLines($"../../../Exam1/dictionary.txt");
            Encryption encryptor;
            string     key;
            string     text = string.Empty;
            KMP        kmp;
            int        wordsFound = 0;
            bool       flag       = false;

            for (int i = 0; i < 100; i++)
            {
                wordsFound = 0;
                key        = i.ToString();
                encryptor  = new Encryption(key, ' ', 'z', false);
                text       = encryptor.Decrypt(cipher);
                kmp        = new KMP(text);
                for (int j = 0; j < dict.Length; j++)
                {
                    if (dict[j].Length < 5)
                    {
                        continue;
                    }
                    wordsFound += kmp.Match(dict[j]);
                    if (wordsFound > 10)
                    {
                        flag = true;
                        break;
                    }
                }
                if (flag)
                {
                    break;
                }
            }
            return(text.GetHashCode().ToString());
        }