DSA.TryHashData Method

Definition

Attempts to compute the hash value of the provided data into a provided buffer.

C#
protected virtual bool TryHashData(ReadOnlySpan<byte> data, Span<byte> destination, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, out int bytesWritten);

Parameters

data
ReadOnlySpan<Byte>

The data to be hashed.

destination
Span<Byte>

The byte span to receive the hash value.

hashAlgorithm
HashAlgorithmName

The name of the hash algorithm to use.

bytesWritten
Int32

When this method returns, contains a value that indicates the number of bytes written to destination.

Returns

true if destination is large enough to receive the result; otherwise, false.

Remarks

The default implementation of this method is to call HashData(Byte[], Int32, Int32, HashAlgorithmName) and copy the result to destination.

Derived types should override this method to avoid the intermediate array creation.

Applies to

Produkt Verzie
.NET Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Standard 2.1