public void EncryptWithNullTest()
        {
            const string plaintext = "abbaba";

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

            cipher.Encrypt(plaintext, null);
        }
        public void EncryptNullTest()
        {
            var key = new Key <string>("ABCD");

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

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

            const string plaintext = "aabab";

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

            cipher.Encrypt(plaintext, key);
        }
        public void EncryptTest()
        {
            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(ciphertext, cipher.Encrypt(plaintext, key));
        }
        public void EncryptWrongTextTest()
        {
            var key = new Key <string>("ab");

            const string plaintext = "aacabc";

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

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

            const string plaintext = "aacabc";

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

            cipher.Encrypt(plaintext, 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 CreateWithNullTest()
 {
     var cipher = new VisenereCipher(null);
 }
        public void CreateTest()
        {
            var cipher = new VisenereCipher(Alphabets.English);

            Assert.AreEqual(Alphabets.English, cipher.Alphabet);
        }