Beispiel #1
0
        public static void PlayFairCipherTest()
        {
            Console.WriteLine("9. Шифр \"Плейфер\"");

            Console.WriteLine("Пример работы программы");
            cryptogram = "Dima Bezotosnyi!@#$%^&*12345";
            Console.WriteLine("Текст: " + cryptogram);
            playFairCipher = new PlayFairCipher();
            encryptText    = playFairCipher.Encrypt(cryptogram);
            Console.WriteLine("Зашифрованый текст: " + encryptText);
            decryptText = playFairCipher.Decrypt(encryptText);
            Console.WriteLine("Расшифрованый текст: " + decryptText);

            Console.WriteLine("\n");
        }
        public static string PlayFairCipher(string text, CryptType cryptType)
        {
            string result = string.Empty;
            playFairCipher = new PlayFairCipher();
            switch (cryptType)
            {
                case CryptType.Encrypt:
                    result = playFairCipher.Encrypt(text);
                    break;
                case CryptType.Decrypt:
                    result = playFairCipher.Decrypt(text);
                    break;
            }

            return result;
        }