static void Main(string[] args) { SubstitutionCipher cipher = new SubstitutionCipher(); string secret = cipher.Encrypt("hello"); Console.WriteLine(secret); Console.WriteLine(cipher.Decrypt(secret)); Console.ReadLine(); }
static void Main(string[] args) { SubstitutionCipher sc = new SubstitutionCipher('a', 'z'); sc.GenerateTable(); var message = sc.CipherMessage("hello"); System.Console.WriteLine(message); System.Console.WriteLine(sc.DecipherMessage(message)); sc.GenerateTable(); System.Console.WriteLine(sc.DecipherMessage(message)); System.Console.ReadLine(); }
static void Main(string[] args) { string alphabet = "abcdefghijklmnopqrstuvwxyz"; var subCipher = new SubstitutionCipher(alphabet); string plaintext = "flee at once. we are discovered!"; string key = subCipher.GetPermutedKey(); string cipherText = subCipher.Encrypt(key, plaintext); string decryptedText = subCipher.Decrypt(key, cipherText); Console.WriteLine($"Plaintext: {plaintext}"); Console.WriteLine($"Key: {key}"); Console.WriteLine($"CipherText: {cipherText}"); Console.WriteLine($"DecryptedText: {decryptedText}"); }