C# Class System.Security.Cryptography.IncrementalHash

Inheritance: IDisposable
Show file Open project: dotnet/corefx Class Usage Examples

Public Methods

Method Description
AppendData ( byte data ) : void

Append the entire contents of data to the data already processed in the hash or HMAC.

AppendData ( byte data, int offset, int count ) : void

Append count bytes of data, starting at offset, to the data already processed in the hash or HMAC.

CreateHMAC ( HashAlgorithmName hashAlgorithm, byte key ) : IncrementalHash

Create an IncrementalHash for the Hash-based Message Authentication Code (HMAC) algorithm utilizing the hash algorithm specified by hashAlgorithm, and a key specified by key.

CreateHash ( HashAlgorithmName hashAlgorithm ) : IncrementalHash

Create an IncrementalHash for the algorithm specified by hashAlgorithm.

Dispose ( ) : void

Release all resources used by the current instance of the IncrementalHash class.

GetHashAndReset ( ) : byte[]

Retrieve the hash or HMAC for the data accumulated from prior calls to AppendData(byte[]), and return to the state the object was in at construction.

Private Methods

Method Description
GetHMAC ( HashAlgorithmName hashAlgorithm, byte key ) : HashAlgorithm
GetHashAlgorithm ( HashAlgorithmName hashAlgorithm ) : HashAlgorithm
IncrementalHash ( HashAlgorithmName name, HashAlgorithm hash ) : System.Diagnostics

Method Details

AppendData() public method

Append the entire contents of data to the data already processed in the hash or HMAC.
is null. The object has already been disposed.
public AppendData ( byte data ) : void
data byte The data to process.
return void

AppendData() public method

Append count bytes of data, starting at offset, to the data already processed in the hash or HMAC.
is null. /// is out of range. This parameter requires a non-negative number. /// /// is out of range. This parameter requires a non-negative number less than /// the value of . /// /// is greater than /// . - . /// The object has already been disposed.
public AppendData ( byte data, int offset, int count ) : void
data byte The data to process.
offset int The offset into the byte array from which to begin using data.
count int The number of bytes in the array to use as data.
return void

CreateHMAC() public static method

Create an IncrementalHash for the Hash-based Message Authentication Code (HMAC) algorithm utilizing the hash algorithm specified by hashAlgorithm, and a key specified by key.
/// . is null, or /// the empty string. /// is not a known hash algorithm.
public static CreateHMAC ( HashAlgorithmName hashAlgorithm, byte key ) : IncrementalHash
hashAlgorithm HashAlgorithmName The name of the hash algorithm to perform within the HMAC.
key byte /// The secret key for the HMAC. The key can be any length, but a key longer than the output size /// of the hash algorithm specified by will be hashed (using the /// algorithm specified by ) to derive a correctly-sized key. Therefore, /// the recommended size of the secret key is the output size of the hash specified by /// . ///
return IncrementalHash

CreateHash() public static method

Create an IncrementalHash for the algorithm specified by hashAlgorithm.
/// . is null, or /// the empty string. /// is not a known hash algorithm.
public static CreateHash ( HashAlgorithmName hashAlgorithm ) : IncrementalHash
hashAlgorithm HashAlgorithmName The name of the hash algorithm to perform.
return IncrementalHash

Dispose() public method

Release all resources used by the current instance of the IncrementalHash class.
public Dispose ( ) : void
return void

GetHashAndReset() public method

Retrieve the hash or HMAC for the data accumulated from prior calls to AppendData(byte[]), and return to the state the object was in at construction.
The object has already been disposed.
public GetHashAndReset ( ) : byte[]
return byte[]