public List <byte[]> Decrypt(ISymmetricCipher symmetricCipher, List <byte[]> cipherText)
        {
            var decryptedMessage = new byte[cipherText.Count][];

            Parallel.For(0, cipherText.Count,
                         blockNumber =>
            {
                var currentBlock = blockNumber > 0 ? cipherText[blockNumber - 1] : InitializationVector;
                var decryptdData = symmetricCipher.Encrypt(currentBlock);
                var openText     = CipherUtils.XorByteArrays(decryptdData, cipherText[blockNumber]);
                decryptedMessage[blockNumber] = openText;
            });

            return(decryptedMessage.ToList());
        }
        public List <byte[]> Encrypt(ISymmetricCipher symmetricCipher, List <byte[]> openText)
        {
            var c = InitializationVector;
            var encryptedMessage = new List <byte[]>();

            foreach (var messageBlock in openText)
            {
                var encryptedBlock = symmetricCipher.Encrypt(c);
                var xoredBlock     = CipherUtils.XorByteArrays(encryptedBlock, messageBlock);
                c = xoredBlock;
                encryptedMessage.Add(xoredBlock);
            }

            return(encryptedMessage);
        }
        private List <byte[]> EncryptionConvertion(ISymmetricCipher symmetricCipher, List <byte[]> cipherText)
        {
            var c = InitializationVector;

            var encryptedMessage = new byte[cipherText.Count][];

            for (int i = 0; i < encryptedMessage.Length; i++)
            {
                encryptedMessage[i] = symmetricCipher.Encrypt(c);
                c = encryptedMessage[i];
            }

            Parallel.For(0, encryptedMessage.Length,
                         blockNumber => encryptedMessage[blockNumber] = CipherUtils.XorByteArrays(cipherText[blockNumber], encryptedMessage[blockNumber]));

            return(encryptedMessage.ToList());
        }