예제 #1
0
        public void EncryptBasicTest()
        {
            ADFGVX adfgvx        = new ADFGVX(new CipherNet.Common.Alphabet("PH0QG64MEA1YL2NOFDXKR3CVS5ZW7BJ9UTI8", false), "GERMAN");
            var    encryptedText = adfgvx.Encrypt("DEFENDTHEEASTWALLOFTHECASTLE");

            Assert.AreEqual("FFDVDFADFXXFGFGAVFAFFDXDXFFDVDFFDGGAGVGXVXFAGGDGAXDFADVFXGXX", encryptedText);
        }
예제 #2
0
        public void DecryptBasicTest()
        {
            ADFGVX adfgvx        = new ADFGVX(new CipherNet.Common.Alphabet("PH0QG64MEA1YL2NOFDXKR3CVS5ZW7BJ9UTI8", false), "GERMAN");
            var    encryptedText = adfgvx.Decrypt("FFDVDFADFXXFGFGAVFAFFDXDXFFDVDFFDGGAGVGXVXFAGGDGAXDFADVFXGXX");

            // Starts with as the result could (and will) be padded
            Assert.IsTrue(encryptedText.StartsWith("DEFENDTHEEASTWALLOFTHECASTLE", StringComparison.Ordinal));
        }
예제 #3
0
        public void TestLongExample()
        {
            var obfuscator = new ADFGVX("calf");

            var cipherText = obfuscator.EncryptMessage("Bradford County 4H leaders and the bradford county holstein club have joined forces again this year to plan and organize a 4h" +
                " heifer sale stop Our goal is to sell 70 calves and heifers along with some s***n feed etc stop if you are interested in consigning a calf or heifer please contact gary hennip stop");

            var plainText = obfuscator.DecryptMessage(cipherText);
        }
예제 #4
0
        public void TestMethod1()
        {
            var obfuscator = new ADFGVX("code");

            var cipherText = obfuscator.EncryptMessage("hello world");

            var plainText = obfuscator.DecryptMessage(cipherText);

            Assert.AreEqual("HELLOWORLD", plainText);
        }
예제 #5
0
        public void TestMethod1()
        {
            var obfuscator = new ADFGVX("code");

            var cipherText = obfuscator.EncryptMessage("hello world");

            var plainText = obfuscator.DecryptMessage(cipherText);

            Assert.AreEqual("HELLOWORLD", plainText);
        }
예제 #6
0
        public void TestLongExample()
        {
            var obfuscator = new ADFGVX("calf");
            
            var cipherText = obfuscator.EncryptMessage("Bradford County 4H leaders and the bradford county holstein club have joined forces again this year to plan and organize a 4h" +
                " heifer sale stop Our goal is to sell 70 calves and heifers along with some s***n feed etc stop if you are interested in consigning a calf or heifer please contact gary hennip stop");

            var plainText = obfuscator.DecryptMessage(cipherText);


        }
예제 #7
0
 private void ADFGVXDecrypt(object sender, EventArgs e)
 {
     try
     {
         if (ValidateInputs(EncodeMode.Decrypt))
         {
             var encoder = new ADFGVX(textBox4.Text, textBox3.Text.ToUpper());
             richTextBox2.Text = encoder.Decrypt(richTextBox1.Text);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
예제 #8
0
        public void Unigraph_ADFGVXTest()
        {
            ADFGVX adfgvx = new ADFGVX(Utility.EnglishAlphabet());

            adfgvx.Square = "phqg0iu7me4ay5lno8jfd9xk6rc2vs4tz1wb3".ToUpper().ToCharArray();
            adfgvx.Key    = "GERMAN";

            for (int i = 0; i < 25; i++)
            {
                generated = adfgvx.GenerateRandomString();

                cipher = adfgvx.Encrypt(generated);
                clear  = adfgvx.Decrypt(cipher);

                Assert.AreEqual(generated, clear);
            }
        }