Exemple #1
0
        public void TestMethod1()
        {
            string input  = "ABC";
            string output = "CDE";
            int    shift  = 2;

            string encrypted = cc.encrypt(input, shift);
            string decrypted = cc.decrypt(encrypted, shift);

            Assert.AreEqual(encrypted, output);
            Assert.AreEqual(decrypted, input);
        }
Exemple #2
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            string        s      = TextBox1.Text.ToString();
            int           num    = Convert.ToInt32(TextBox2.Text);
            StringBuilder cipher = CaesarCipher.encrypt(s, num);

            Response.Write("<script>alert('The Encrypted string equals : " + cipher + "')</script>");
            TextBox1.Text = "";
            TextBox2.Text = "";
        }
        private void encode_using_cesare()
        {
            CaesarCipher cipher = new CaesarCipher(Convert.ToInt32(cipher_keybox.Text));

            cipher_output.Text = cipher.encrypt(cipher_input.Text.Trim());
        }