Uredi

Deli z drugimi prek


CryptographicOperations.TryHashData Method

Definition

Attempts to compute the hash of data.

public:
 static bool TryHashData(System::Security::Cryptography::HashAlgorithmName hashAlgorithm, ReadOnlySpan<System::Byte> source, Span<System::Byte> destination, [Runtime::InteropServices::Out] int % bytesWritten);
public static bool TryHashData (System.Security.Cryptography.HashAlgorithmName hashAlgorithm, ReadOnlySpan<byte> source, Span<byte> destination, out int bytesWritten);
static member TryHashData : System.Security.Cryptography.HashAlgorithmName * ReadOnlySpan<byte> * Span<byte> * int -> bool
Public Shared Function TryHashData (hashAlgorithm As HashAlgorithmName, source As ReadOnlySpan(Of Byte), destination As Span(Of Byte), ByRef bytesWritten As Integer) As Boolean

Parameters

hashAlgorithm
HashAlgorithmName

The algorithm used to compute the hash.

source
ReadOnlySpan<Byte>

The data to hash.

destination
Span<Byte>

The buffer to receive the hash value.

bytesWritten
Int32

When this method returns, the total number of bytes written into destination.

Returns

false if destination is too small to hold the calculated hash, true otherwise.

Exceptions

hashAlgorithm has a Name that is empty.

hashAlgorithm has a Name that is null.

hashAlgorithm specifies a hash algorithm not supported by the current platform.

hashAlgorithm specifies an unknown hash algorithm.

Applies to