示例#1
0
        static void Main(string[] args)
        {
            string cipherText0 = "UIF RVJDL CSPXO GPY KVNQT PWFS 13 MBAZ EPHT."; // 1

            Console.WriteLine("Test Cipher Text: " + CaesarCipher.decrypt(cipherText0, 1));

            //string cipherText1 = "KVXUAOGRRDRBGFTPDVWRMCDWTELUAWXILKNZGVXTYHPEMQVHVETIABPSMVHXYIGFMBNLLPOPDAENTAGNLRETMSTIABPHXVAEMSICSLKOGCTXNYTPDXNOJWEGVLRCNWER";
            //string cipherText1 = "ASTZHSSJNSBZFPSSJESNTBPZHNLREYUWCFWYUAXSJEGSTHDDCIPCBEVADINCCQYREYUBLFIDVWJOJOKDPOPQFKXHDPTWCASTZHMSOZZZLBZEVASSJDONPHKWRPSOPEVA";
            string cipherText1 = "FWURLERNWEAIFLXFNTIEUVCHDIGXMHIEIIOGFUGTEWRNWZTLVEFJTARTMYEREOPFPIFSXVAVYOMYEKFNXMEKPPKFPHJAEJNHNBTCLLVLHHUXECXRLEFWLYIFKOVFNMIO";

            Console.WriteLine("CipherText: " + cipherText1);
            Console.WriteLine("\nPlain Text: " + VigenereCipher.decrypt(cipherText1, 3));

            Console.ReadLine();
        }
示例#2
0
        static void Main(string[] args)
        {
            //table contains chars from range 32 - 126
            VigenereCipher cipher = new VigenereCipher(32, 126);

            //print table
            Console.WriteLine(cipher.tableToString(" "));

            //encrypting and decrypting word "MICHIGAN" using key
            string key     = ".F#1s!";
            string encrypt = cipher.encrypt("MICHIGAN", key);
            string decrypt = cipher.decrypt(encrypt, key);

            //print results
            Console.WriteLine(encrypt);
            Console.WriteLine(decrypt);

            Console.ReadKey();
        }