Example #1
0
        static void Main(string[] args)
        {
            ROT13 concreteImplementation = new ROT13();
            AutoKey autokey = new AutoKey("CIFRADO");
            ADFGX asdfghjkl = new ADFGX("CARGO");

            autokey.SetEncryptor(concreteImplementation);
            asdfghjkl.SetEncryptor(autokey);

            string ciphertext = asdfghjkl.Cifrar("Hola");
            Console.WriteLine(ciphertext);
            string decryptedText = asdfghjkl.Descifrar(ciphertext);
            Console.WriteLine(decryptedText);
            Console.Read();
            //AutoKey autokey = new AutoKey("CIFRADO");
            //string ciphertext = autokey.Cifrar("hola");
            //Console.Write(ciphertext);
            //string decryptedText = autokey.Descifrar(ciphertext);
            //Console.WriteLine(decryptedText);
            //Console.Read();

            //ADFGX asdfghjkl = new ADFGX("CARGO");
            //Console.WriteLine("Cifrandon Mensaje");
            //var cifrado = asdfghjkl.Cifrar("attack at once");
            //Console.WriteLine(cifrado);
            //Console.WriteLine("Descifrando Mensaje");
            //var descifrado = asdfghjkl.Descifrar(cifrado);
            //Console.WriteLine(descifrado);
            //Console.ReadLine();
        }