示例#1
0
        private void button8_Click(object sender, EventArgs e)
        {
            hasher h      = new hasher();
            string output = h.rinjdael_encode(textBox1.Text, "password");

            textBox2.Text = output;
        }
示例#2
0
        public void rinjdael_decodeTest()
        {
            string orignal = "I am a test.";

            hasher h       = new hasher();
            string cypher  = h.rinjdael_encode(orignal);
            string decoded = h.rinjdael_decode(cypher);

            Assert.AreEqual(orignal, decoded);
            Assert.AreNotEqual(cypher, decoded);
        }
示例#3
0
        public void rinjdael_modifiedPasswordCannotDecrypt()
        {
            string orignal  = "I am a test.";
            string password = "******";

            hasher h      = new hasher();
            string cypher = h.rinjdael_encode(orignal, password);

            // password is modified here
            string decoded1 = h.rinjdael_decode(cypher, password + " ");
            string decoded2 = h.rinjdael_decode(cypher, password);

            Assert.AreNotEqual(orignal, decoded1);
            Assert.AreEqual(orignal, decoded2);
        }
示例#4
0
        public void rinjdael_decodeLongTextTest()
        {
            string password = "******";

            // generates a very long text
            string orignal = "A Quick Brown Fox Jumps Over The Lazy Dog.";

            for (int i = 0; i < 20; ++i)
            {
                orignal += string.Format("#{0}. {1}", i, orignal);
            }

            hasher h       = new hasher();
            string cypher  = h.rinjdael_encode(orignal, password);
            string decoded = h.rinjdael_decode(cypher, password);

            Assert.AreEqual(orignal, decoded);
            Assert.AreNotEqual(cypher, decoded);
        }