/// <summary> /// Decrypts the specified region of the input byte array and copies the decrypted data to the specified region of the output byte array. /// </summary> /// <param name="inputBuffer">The input data to decrypt.</param> /// <param name="inputOffset">The offset into the input byte array from which to begin using data.</param> /// <param name="inputCount">The number of bytes in the input byte array to use as data.</param> /// <param name="outputBuffer">The output to which to write decrypted data.</param> /// <param name="outputOffset">The offset into the output byte array from which to begin writing data.</param> /// <returns> /// The number of bytes decrypted. /// </returns> public override int DecryptBlock(byte[] inputBuffer, int inputOffset, int inputCount, byte[] outputBuffer, int outputOffset) { if ((inputOffset + this.BlockSize) > inputBuffer.Length) { throw new IndexOutOfRangeException("input buffer too short"); } if ((outputOffset + this.BlockSize) > outputBuffer.Length) { throw new IndexOutOfRangeException("output buffer too short"); } if (this._decryptionKey == null) { this._decryptionKey = GenerateWorkingKey(false, this.Key); } DesCipher.DesFunc(this._decryptionKey, inputBuffer, inputOffset, outputBuffer, outputOffset); return(this.BlockSize); }