public void EncryptEmptyData() { byte[] data = new byte[0]; CryptoXor crypto = new CryptoXor(128); byte[] encryptedData = crypto.Encrypt(data); Assert.AreEqual(0, encryptedData.Length); }
public void TestEncryption() { int key = 128; byte[] data = new byte[] { 0, 100, 128, 255 }; CryptoXor crypto = new CryptoXor(128); byte[] encryptedData = crypto.Encrypt(data); Assert.AreEqual(data[0] ^ key, encryptedData[0]); Assert.AreEqual(data[1] ^ key, encryptedData[1]); Assert.AreEqual(data[2] ^ key, encryptedData[2]); Assert.AreEqual(data[3] ^ key, encryptedData[3]); }