Uređivanje

Dijeli putem


CryptographicOperations.HashData Method

Definition

Overloads

HashData(HashAlgorithmName, Byte[])

Computes the hash of data.

HashData(HashAlgorithmName, Stream)

Computes the hash of a stream.

HashData(HashAlgorithmName, ReadOnlySpan<Byte>)

Computes the hash of data.

HashData(HashAlgorithmName, Stream, Span<Byte>)

Computes the hash of a stream.

HashData(HashAlgorithmName, ReadOnlySpan<Byte>, Span<Byte>)

Computes the hash of data.

HashData(HashAlgorithmName, Byte[])

Source:
CryptographicOperations.cs

Computes the hash of data.

public:
 static cli::array <System::Byte> ^ HashData(System::Security::Cryptography::HashAlgorithmName hashAlgorithm, cli::array <System::Byte> ^ source);
public static byte[] HashData (System.Security.Cryptography.HashAlgorithmName hashAlgorithm, byte[] source);
static member HashData : System.Security.Cryptography.HashAlgorithmName * byte[] -> byte[]
Public Shared Function HashData (hashAlgorithm As HashAlgorithmName, source As Byte()) As Byte()

Parameters

hashAlgorithm
HashAlgorithmName

The algorithm used to compute the hash.

source
Byte[]

The data to hash.

Returns

Byte[]

The hash of the data.

Exceptions

source is null.

-or-

hashAlgorithm has a Name that is null.

hashAlgorithm has a Name that is empty.

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

hashAlgorithm specifies an unknown hash algorithm.

Applies to

HashData(HashAlgorithmName, Stream)

Source:
CryptographicOperations.cs

Computes the hash of a stream.

public:
 static cli::array <System::Byte> ^ HashData(System::Security::Cryptography::HashAlgorithmName hashAlgorithm, System::IO::Stream ^ source);
public static byte[] HashData (System.Security.Cryptography.HashAlgorithmName hashAlgorithm, System.IO.Stream source);
static member HashData : System.Security.Cryptography.HashAlgorithmName * System.IO.Stream -> byte[]
Public Shared Function HashData (hashAlgorithm As HashAlgorithmName, source As Stream) As Byte()

Parameters

hashAlgorithm
HashAlgorithmName

The algorithm used to compute the hash.

source
Stream

The stream to hash.

Returns

Byte[]

The hash of the data.

Exceptions

source is null.

-or-

hashAlgorithm has a Name that is null.

hashAlgorithm has a Name that is empty.

-or-

source does not support reading.

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

hashAlgorithm specifies an unknown hash algorithm.

Applies to

HashData(HashAlgorithmName, ReadOnlySpan<Byte>)

Source:
CryptographicOperations.cs

Computes the hash of data.

public:
 static cli::array <System::Byte> ^ HashData(System::Security::Cryptography::HashAlgorithmName hashAlgorithm, ReadOnlySpan<System::Byte> source);
public static byte[] HashData (System.Security.Cryptography.HashAlgorithmName hashAlgorithm, ReadOnlySpan<byte> source);
static member HashData : System.Security.Cryptography.HashAlgorithmName * ReadOnlySpan<byte> -> byte[]
Public Shared Function HashData (hashAlgorithm As HashAlgorithmName, source As ReadOnlySpan(Of Byte)) As Byte()

Parameters

hashAlgorithm
HashAlgorithmName

The algorithm used to compute the hash.

source
ReadOnlySpan<Byte>

The data to hash.

Returns

Byte[]

The hash of the data.

Exceptions

hashAlgorithm has a Name that is null.

hashAlgorithm has a Name that is empty.

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

hashAlgorithm specifies an unknown hash algorithm.

Applies to

HashData(HashAlgorithmName, Stream, Span<Byte>)

Source:
CryptographicOperations.cs

Computes the hash of a stream.

public:
 static int HashData(System::Security::Cryptography::HashAlgorithmName hashAlgorithm, System::IO::Stream ^ source, Span<System::Byte> destination);
public static int HashData (System.Security.Cryptography.HashAlgorithmName hashAlgorithm, System.IO.Stream source, Span<byte> destination);
static member HashData : System.Security.Cryptography.HashAlgorithmName * System.IO.Stream * Span<byte> -> int
Public Shared Function HashData (hashAlgorithm As HashAlgorithmName, source As Stream, destination As Span(Of Byte)) As Integer

Parameters

hashAlgorithm
HashAlgorithmName

The algorithm used to compute the hash.

source
Stream

The stream to hash.

destination
Span<Byte>

The buffer to receive the hash value.

Returns

The total number of bytes written to destination.

Exceptions

source is null.

-or-

hashAlgorithm has a Name that is null.

The buffer in destination is too small to hold the calculated hash size.

-or-

hashAlgorithm has a Name that is empty.

-or-

source does not support reading.

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

hashAlgorithm specifies an unknown hash algorithm.

Applies to

HashData(HashAlgorithmName, ReadOnlySpan<Byte>, Span<Byte>)

Source:
CryptographicOperations.cs

Computes the hash of data.

public:
 static int HashData(System::Security::Cryptography::HashAlgorithmName hashAlgorithm, ReadOnlySpan<System::Byte> source, Span<System::Byte> destination);
public static int HashData (System.Security.Cryptography.HashAlgorithmName hashAlgorithm, ReadOnlySpan<byte> source, Span<byte> destination);
static member HashData : System.Security.Cryptography.HashAlgorithmName * ReadOnlySpan<byte> * Span<byte> -> int
Public Shared Function HashData (hashAlgorithm As HashAlgorithmName, source As ReadOnlySpan(Of Byte), destination As Span(Of Byte)) As Integer

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.

Returns

The total number of bytes written to destination.

Exceptions

The buffer in destination is too small to hold the calculated hash size.

-or-

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