public override int DecryptBlock(byte[] inputBuffer, int inputOffset, int inputCount, byte[] outputBuffer, int outputOffset)
{
if (inputBuffer.Length - inputOffset < _blockSize)
throw new ArgumentException("Invalid input buffer");
if (outputBuffer.Length - outputOffset < _blockSize)
throw new ArgumentException("Invalid output buffer");
if (inputCount != _blockSize)
throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "inputCount must be {0}.", _blockSize));
Cipher.EncryptBlock(IV, 0, IV.Length, _ivOutput, 0);
for (int i = 0; i < _blockSize; i++)
{
outputBuffer[outputOffset + i] = (byte)(_ivOutput[i] ^ inputBuffer[inputOffset + i]);
}
int j = IV.Length;
while (--j >= 0 && ++IV[j] == 0) ;
return _blockSize;
}
}