コード例 #1
0
        public void cipher_test2()
        {
            Caesar.set_key(5, 123);
            Vigenere.set_key("FBI", 123);
            Atbash.set_key(123);
            Caesar   c2 = new Caesar();
            Vigenere v2 = new Vigenere();
            Atbash   a  = new Atbash();

            string t = "Hi bob";

            Assert.IsTrue(t == c2.decrypt(c2.encrypt(t)));
            Assert.IsTrue(t == v2.decrypt(v2.encrypt(t)));
            Assert.IsTrue(t == a.decrypt(a.encrypt(t)));
            t = "Not yet";
            Assert.IsTrue(t == c2.decrypt(c2.encrypt(t)));
            Assert.IsTrue(t == v2.decrypt(v2.encrypt(t)));
            t = "The American Dream is a national ethos of the United States";
            Assert.IsTrue(t == c2.decrypt(c2.encrypt(t)));
            Assert.IsTrue(t == v2.decrypt(v2.encrypt(t)));
            t = "just test it";
            Assert.IsTrue(t == c2.decrypt(c2.encrypt(t)));
            Assert.IsTrue(t == v2.decrypt(v2.encrypt(t)));
        }
コード例 #2
0
 public IActionResult at_encrypt(Atbash at)
 {
     at.encrypt(Request.Form["plaintext"]);
     return(View("Atbash", at));
 }