public byte[] ComputeHash(Stream inputStream) { if (_disposed) throw new ObjectDisposedException(null); // Default the buffer size to 4K. byte[] buffer = new byte[4096]; int bytesRead; while ((bytesRead = inputStream.Read(buffer, 0, buffer.Length)) > 0) { HashCore(buffer, 0, bytesRead); } return CaptureHashCodeAndReinitialize(); }
public static byte[] DoubleDigest(byte[] input, int offset, int length) { _digest.Dispose(); _digest = new SHA256CryptoServiceProvider(); byte[] first = _digest.ComputeHash(input, offset, length); return _digest.ComputeHash(first); }