SHA3_256.HashDataAsync Method

Definition

Overloads

HashDataAsync(Stream, CancellationToken)

Asynchronously computes the hash of a stream using the SHA3-256 algorithm.

HashDataAsync(Stream, Memory<Byte>, CancellationToken)

Asynchronously computes the hash of a stream using the SHA3-256 algorithm.

HashDataAsync(Stream, CancellationToken)

Source:
SHA3_256.cs
Source:
SHA3_256.cs

Asynchronously computes the hash of a stream using the SHA3-256 algorithm.

public static System.Threading.Tasks.ValueTask<byte[]> HashDataAsync (System.IO.Stream source, System.Threading.CancellationToken cancellationToken = default);
static member HashDataAsync : System.IO.Stream * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask<byte[]>
Public Shared Function HashDataAsync (source As Stream, Optional cancellationToken As CancellationToken = Nothing) As ValueTask(Of Byte())

Parameters

source
Stream

The stream to hash.

cancellationToken
CancellationToken

The token to monitor for cancellation requests. The default value is None.

Returns

The hash of the data.

Exceptions

source is null.

source does not support reading.

The platform does not support SHA3-256.

The cancellation token was canceled. This exception is stored into the returned task.

Applies to

HashDataAsync(Stream, Memory<Byte>, CancellationToken)

Source:
SHA3_256.cs
Source:
SHA3_256.cs

Asynchronously computes the hash of a stream using the SHA3-256 algorithm.

public static System.Threading.Tasks.ValueTask<int> HashDataAsync (System.IO.Stream source, Memory<byte> destination, System.Threading.CancellationToken cancellationToken = default);
static member HashDataAsync : System.IO.Stream * Memory<byte> * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask<int>
Public Shared Function HashDataAsync (source As Stream, destination As Memory(Of Byte), Optional cancellationToken As CancellationToken = Nothing) As ValueTask(Of Integer)

Parameters

source
Stream

The stream to hash.

destination
Memory<Byte>

The buffer to receive the hash value.

cancellationToken
CancellationToken

The token to monitor for cancellation requests. The default value is None.

Returns

The total number of bytes written to destination.

Exceptions

source is null.

The buffer in destination is too small to hold the calculated hash size. The SHA3-256 algorithm always produces a 256-bit hash, or 32 bytes.

-or-

source does not support reading.

The platform does not support SHA3-256.

The cancellation token was canceled. This exception is stored into the returned task.

Applies to