System.Security.Cryptography.HashAlgorithm.ComputeHash C# (CSharp) Method

ComputeHash() public method

public ComputeHash ( Stream inputStream ) : byte[]
inputStream System.IO.Stream
return byte[]
        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();
        }

Same methods

HashAlgorithm::ComputeHash ( byte buffer ) : byte[]
HashAlgorithm::ComputeHash ( byte buffer, int offset, int count ) : byte[]

Usage Example

Beispiel #1
0
 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);
 }
All Usage Examples Of System.Security.Cryptography.HashAlgorithm::ComputeHash