示例#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
 private void ADFGVXEncrypt(object sender, EventArgs e)
 {
     try
     {
         if (ValidateInputs(EncodeMode.Encrypt))
         {
             var encoder = new ADFGVX(textBox4.Text, textBox3.Text);
             richTextBox2.Text = encoder.Encrypt(richTextBox1.Text);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
示例#3
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);
            }
        }