CryptographicOperations.TryHashData Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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.
- 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.