RSA.TryHashData(ReadOnlySpan<Byte>, Span<Byte>, HashAlgorithmName, Int32) Method

Definition

Attempts to compute the hash of the provided data by using the specified algorithm, writing the results into a provided buffer.

protected:
 virtual bool TryHashData(ReadOnlySpan<System::Byte> data, Span<System::Byte> destination, System::Security::Cryptography::HashAlgorithmName hashAlgorithm, [Runtime::InteropServices::Out] int % bytesWritten);
protected virtual bool TryHashData (ReadOnlySpan<byte> data, Span<byte> destination, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, out int bytesWritten);
abstract member TryHashData : ReadOnlySpan<byte> * Span<byte> * System.Security.Cryptography.HashAlgorithmName * int -> bool
override this.TryHashData : ReadOnlySpan<byte> * Span<byte> * System.Security.Cryptography.HashAlgorithmName * int -> bool
Protected Overridable Function TryHashData (data As ReadOnlySpan(Of Byte), destination As Span(Of Byte), hashAlgorithm As HashAlgorithmName, ByRef bytesWritten As Integer) As Boolean

Parameters

data
ReadOnlySpan<Byte>

The data to be hashed.

destination
Span<Byte>

The buffer to receive the hash value.

hashAlgorithm
HashAlgorithmName

The algorithm to use in hash the data.

bytesWritten
Int32

When this method returns, the total number of bytes written into destination. This parameter is treated as uninitialized.

Returns

true if destination is long enough to receive the hash value; otherwise, false.

Remarks

The default implementation of this method calls HashData(Byte[], Int32, Int32, HashAlgorithmName) and copies the result to destination. Derived types should override this method to avoid the intermediate array creation.

Applies to