コード例 #1
0
ファイル: Program.cs プロジェクト: ballance/MexicanArmyCipher
        private static void RunSolve()
        {
            var sw = new Stopwatch();

            sw.Start();
            var letterDistributionEnglish = new LetterDistributionCollection();

            letterDistributionEnglish.Load();

            var fileHelper         = new FileHelper();
            var cipherTextFromFile = fileHelper.GetCipherTextFromFile(@"c:\home\temp\cipherText.txt");
            var textToDecode       = cipherTextFromFile.Split(' ');

            var codeWheelSystem = LoadMexicanArmyCodeWheel(new CryptoWheelSystem <string>(26));

            System.Console.Write("Decyphering.");

            //SolveKnownConfiguration(codeWheelSystem, textToDecode);

            var solver    = new Solver();
            var solutions = solver.BruteForce(codeWheelSystem, textToDecode, fileHelper);

            foreach (var solution in solutions)
            {
                fileHelper.WritePlainTextToFile(solution.DecodedText, solution.WheelConfiguration);
            }
            sw.Stop();
            System.Console.WriteLine($"Completed in {sw.Elapsed.TotalSeconds} seconds.");
            System.Console.ReadKey();
        }
コード例 #2
0
 public void TearDown()
 {
     _letterDistributionEnglish = null;
 }