public void SubsitutionCipher() { string text = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; string cipher = "DSJLPMECOGNWZ"; SubstitutionCipher sc = new SubstitutionCipher(text, cipher); string textEncrypt = sc.Encrypt(text); System.Console.Out.WriteLine(text); System.Console.Out.WriteLine(textEncrypt); Assert.That(text != textEncrypt); string textDecrypt = sc.Decrypt(textEncrypt); System.Console.Out.WriteLine(text); System.Console.Out.WriteLine(textDecrypt); Assert.That(text == textDecrypt); }
public void RandomSubstitutionCipherNonCaseSensitive() { for (int i = 0; i < 500; i++) { string text = ToolCipher.GenerateText(ToolCipher.AllChar, 500); string plain = ToolCipher.abc + ToolCipher.Number0At9; string cipher = ToolCipher.MixedString(plain, 10); SubstitutionCipher sc = new SubstitutionCipher(plain, cipher); string textEncrypt = sc.Encrypt(text); System.Console.Out.WriteLine(text); System.Console.Out.WriteLine(textEncrypt); Assert.That(text != textEncrypt); string textDecrypt = sc.Decrypt(textEncrypt); System.Console.Out.WriteLine(text); System.Console.Out.WriteLine(textDecrypt); Assert.That(text == textDecrypt); } }