public void DecryptNullTest()
        {
            var key = new Key <string>("ABCD");

            var cipher = new VisenereCipher(new Alphabet("ABCD"));

            cipher.Decrypt(null, key);
        }
        public void DecryptWrongKeyTest()
        {
            var key = new Key <string>("abc");

            const string ciphertext = "aabab";

            var cipher = new VisenereCipher(new Alphabet("ab"));

            cipher.Decrypt(ciphertext, key);
        }
        public void DecryptTest()
        {
            const string plaintext  = "CRYPTOISSHORTFORCRYPTOGRAPHY";
            const string ciphertext = "CSASTPKVSIQUTGQUCSASTPIUAQJB";

            var key      = new Key <string>("ABCD");
            var alphabet = new Alphabet("ABCDEFGHIJKLMNOPQRSTUVWXYZ");

            var cipher = new VisenereCipher(alphabet);

            Assert.AreEqual(plaintext, cipher.Decrypt(ciphertext, key));
        }
        public void AbsorbtionTest()
        {
            const string plaintext = "CRYPTOISSHORTFORCRYPTOGRAPHY";

            var key      = new Key <string>("ABCD");
            var alphabet = new Alphabet("ABCDEFGHIJKLMNOPQRSTUVWXYZ");

            var cipher = new VisenereCipher(alphabet);

            Assert.AreEqual(
                plaintext,
                cipher.Decrypt(cipher.Encrypt(plaintext, key), key));
        }
        public void DecryptWrongTextTest()
        {
            var key = new Key <string>("ab");

            const string ciphertext = "aacabc";

            var cipher = new VisenereCipher(new Alphabet("ab"))
            {
                IsStrict = false
            };

            Assert.AreEqual("abcbbc", cipher.Decrypt(ciphertext, key));
        }
        public void DecryptWrongTextStrictTest()
        {
            var key = new Key <string>("ab");

            const string ciphertext = "aacabc";

            var cipher = new VisenereCipher(new Alphabet("ab"))
            {
                IsStrict = true
            };

            cipher.Decrypt(ciphertext, key);
        }