Exemplo n.º 1
0
        public void DecryptBasicTest()
        {
            ADFGX adfgx         = new ADFGX(new CipherNet.Common.Alphabet("PHQGMEAYNOFDXKRCVSZWBUTIL", false), "GERMAN");
            var   encryptedText = adfgx.Decrypt("XFDDDDFAFGXG");

            Assert.AreEqual("ATTACK", encryptedText);
        }
Exemplo n.º 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);
            }
        }