Example #1
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);
        }
Example #2
0
        private void button9_Click(object sender, EventArgs e)
        {
            hasher h      = new hasher();
            string output = h.rinjdael_decode(textBox2.Text, "password");

            textBox1.Text = output;
        }
Example #3
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);
        }
Example #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);
        }