CryptographicOperations.HashData 方法

定義

多載

HashData(HashAlgorithmName, Byte[])

計算數據的哈希。

HashData(HashAlgorithmName, Stream)

計算數據流的哈希。

HashData(HashAlgorithmName, ReadOnlySpan<Byte>)

計算數據的哈希。

HashData(HashAlgorithmName, Stream, Span<Byte>)

計算數據流的哈希。

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

計算數據的哈希。

HashData(HashAlgorithmName, Byte[])

來源:
CryptographicOperations.cs

計算數據的哈希。

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()

參數

hashAlgorithm
HashAlgorithmName

用來計算哈希的演算法。

source
Byte[]

要哈希的數據。

傳回

Byte[]

數據的哈希。

例外狀況

source null

-或-

hashAlgorithm 具有 nullName

hashAlgorithm 具有空白的 Name

hashAlgorithm 指定目前平台不支援的哈希演算法。

hashAlgorithm 指定未知的哈希演算法。

適用於

HashData(HashAlgorithmName, Stream)

來源:
CryptographicOperations.cs

計算數據流的哈希。

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()

參數

hashAlgorithm
HashAlgorithmName

用來計算哈希的演算法。

source
Stream

要哈希的數據流。

傳回

Byte[]

數據的哈希。

例外狀況

source null

-或-

hashAlgorithm 具有 nullName

hashAlgorithm 具有空白的 Name

-或-

source 不支援讀取。

hashAlgorithm 指定目前平台不支援的哈希演算法。

hashAlgorithm 指定未知的哈希演算法。

適用於

HashData(HashAlgorithmName, ReadOnlySpan<Byte>)

來源:
CryptographicOperations.cs

計算數據的哈希。

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()

參數

hashAlgorithm
HashAlgorithmName

用來計算哈希的演算法。

source
ReadOnlySpan<Byte>

要哈希的數據。

傳回

Byte[]

數據的哈希。

例外狀況

hashAlgorithm 具有 nullName

hashAlgorithm 具有空白的 Name

hashAlgorithm 指定目前平台不支援的哈希演算法。

hashAlgorithm 指定未知的哈希演算法。

適用於

HashData(HashAlgorithmName, Stream, Span<Byte>)

來源:
CryptographicOperations.cs

計算數據流的哈希。

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

參數

hashAlgorithm
HashAlgorithmName

用來計算哈希的演算法。

source
Stream

要哈希的數據流。

destination
Span<Byte>

要接收哈希值的緩衝區。

傳回

寫入至 destination的位元組總數。

例外狀況

source null

-或-

hashAlgorithm 具有 nullName

destination 中的緩衝區太小,無法保存導出的哈希大小。

-或-

hashAlgorithm 具有空白的 Name

-或-

source 不支援讀取。

hashAlgorithm 指定目前平台不支援的哈希演算法。

hashAlgorithm 指定未知的哈希演算法。

適用於

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

來源:
CryptographicOperations.cs

計算數據的哈希。

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

參數

hashAlgorithm
HashAlgorithmName

用來計算哈希的演算法。

source
ReadOnlySpan<Byte>

要哈希的數據。

destination
Span<Byte>

要接收哈希值的緩衝區。

傳回

寫入至 destination的位元組總數。

例外狀況

destination 中的緩衝區太小,無法保存導出的哈希大小。

-或-

hashAlgorithm 具有空白的 Name

hashAlgorithm 具有 nullName

hashAlgorithm 指定目前平台不支援的哈希演算法。

hashAlgorithm 指定未知的哈希演算法。

適用於