public void EncryptWrongTextStrictTest() { const string plaintext = "aa,cabc"; var cipher = new CaesarCipher(Alphabets.EnglishLower) { IsStrict = true }; cipher.Encrypt(plaintext, new Key <int>(3)); }
public void EncryptWrongTextTest() { const string plaintext = "aa,cabc"; var cipher = new CaesarCipher(Alphabets.EnglishLower) { IsStrict = false }; Assert.AreEqual( "dd,fdef", cipher.Encrypt(plaintext, new Key <int>(3))); }
public void EncryptTest() { var key = new Key <int>(3); const string plaintext = "aabcabc"; string ciphertext = new String( plaintext.Select(ch => (char)(ch + key.Value)).ToArray()); var cipher = new CaesarCipher(Alphabets.EnglishLower); Assert.AreEqual(ciphertext, cipher.Encrypt(plaintext, key)); }
public void AbsorbtionTest() { var encryptionKey = new Key <int>(3); var decryptionKey = KeyGenerator.GetCaesarDecryptionKey(encryptionKey); const string plaintext = "aabcabc"; var cipher = new CaesarCipher(Alphabets.English); string ciphertext = cipher.Encrypt(plaintext, encryptionKey); Assert.AreEqual(plaintext, cipher.Decrypt(ciphertext, decryptionKey)); }
public void EncryptWithNullTest() { var cipher = new CaesarCipher(Alphabets.English); cipher.Encrypt("aaa", null); }
public void EncryptNullTest() { var cipher = new CaesarCipher(Alphabets.English); cipher.Encrypt(null, new Key <int>(3)); }