Example #1
0
        public void EncryptBasicTest()
        {
            ADFGX adfgx         = new ADFGX(new CipherNet.Common.Alphabet("PHQGMEAYNOFDXKRCVSZWBUTIL", false), "GERMAN");
            var   encryptedText = adfgx.Encrypt("ATTACK");

            Assert.AreEqual("XFDDDDFAFGXG", encryptedText);
        }
Example #2
0
        public void Unigraph_ADFGXTest()
        {
            char[] ch    = new string(Utility.KeyedEnglishAlphabet("KRYPTOS")).Replace("J", "").ToCharArray();
            ADFGX  adfgx = new ADFGX(ch);

            adfgx.Square = "phqgiumeaylnofdxkrcvstzwb".ToUpper().ToCharArray();
            adfgx.Key    = "GERMAN";

            for (int i = 0; i < 25; i++)
            {
                generated = adfgx.GenerateRandomString().Replace("J", "I");

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

                Assert.AreEqual(generated, clear);
            }
        }