Beispiel #1
0
        private static void AffineDecrypt()
        {
            Console.WriteLine("Input your message to decrypt");
            string message = Console.ReadLine();

            Console.WriteLine("Input key a");
            int a = int.Parse(Console.ReadLine());

            Console.WriteLine("Input key b");
            int b = int.Parse(Console.ReadLine());

            var Affine2 = new AffineCipher(a, b);

            Console.WriteLine(Affine2.DecryptMessage(message));
        }
Beispiel #2
0
        private static void AffineEncrypt()
        {
            Console.WriteLine("Input your message to encrypt (in English and without punctuation)");
            string message = Console.ReadLine().ToLower();

            message = message.Replace(" ", string.Empty);
            Console.WriteLine("Input key a (must be relatively prime to the volume of the alphabet)");
            int a = int.Parse(Console.ReadLine());

            Console.WriteLine("Input key b");
            int b       = int.Parse(Console.ReadLine());
            var Affine1 = new AffineCipher(a, b);

            Console.WriteLine(Affine1.EncryptMessage(message));
        }