IncrementalHash.CreateHMAC 方法

定義

多載

CreateHMAC(HashAlgorithmName, Byte[])

使用 hashAlgorithm所指定的哈希演算法,以及 key所指定的索引鍵,建立哈希式訊息驗證碼 (HMAC) 演算法的 IncrementalHash

CreateHMAC(HashAlgorithmName, ReadOnlySpan<Byte>)

使用 hashAlgorithm所指定的哈希演算法,以及 key所指定的索引鍵,建立哈希式訊息驗證碼 (HMAC) 演算法的 IncrementalHash

CreateHMAC(HashAlgorithmName, Byte[])

來源:
IncrementalHash.cs
來源:
IncrementalHash.cs
來源:
IncrementalHash.cs

使用 hashAlgorithm所指定的哈希演算法,以及 key所指定的索引鍵,建立哈希式訊息驗證碼 (HMAC) 演算法的 IncrementalHash

public:
 static System::Security::Cryptography::IncrementalHash ^ CreateHMAC(System::Security::Cryptography::HashAlgorithmName hashAlgorithm, cli::array <System::Byte> ^ key);
[System.Runtime.Versioning.UnsupportedOSPlatform("browser")]
public static System.Security.Cryptography.IncrementalHash CreateHMAC (System.Security.Cryptography.HashAlgorithmName hashAlgorithm, byte[] key);
public static System.Security.Cryptography.IncrementalHash CreateHMAC (System.Security.Cryptography.HashAlgorithmName hashAlgorithm, byte[] key);
[<System.Runtime.Versioning.UnsupportedOSPlatform("browser")>]
static member CreateHMAC : System.Security.Cryptography.HashAlgorithmName * byte[] -> System.Security.Cryptography.IncrementalHash
static member CreateHMAC : System.Security.Cryptography.HashAlgorithmName * byte[] -> System.Security.Cryptography.IncrementalHash
Public Shared Function CreateHMAC (hashAlgorithm As HashAlgorithmName, key As Byte()) As IncrementalHash

參數

hashAlgorithm
HashAlgorithmName

HMAC 內要執行的哈希演算法名稱。

key
Byte[]

HMAC 的秘密金鑰。 索引鍵可以是任何長度,但比 hashAlgorithm 所指定的哈希演算法輸出大小更長的金鑰將會經過哈希處理(使用 hashAlgorithm指定的演算法)來衍生正確大小的密鑰。 因此,建議的秘密金鑰大小是 hashAlgorithm所指定的哈希輸出大小。

傳回

IncrementalHash 實例,可供計算 hashAlgorithm所指定的哈希演算法。

屬性

例外狀況

key null

hashAlgorithmNamenull或空字串。

hashAlgorithm 不是已知的哈希演算法。

適用於

CreateHMAC(HashAlgorithmName, ReadOnlySpan<Byte>)

來源:
IncrementalHash.cs
來源:
IncrementalHash.cs
來源:
IncrementalHash.cs

使用 hashAlgorithm所指定的哈希演算法,以及 key所指定的索引鍵,建立哈希式訊息驗證碼 (HMAC) 演算法的 IncrementalHash

public:
 static System::Security::Cryptography::IncrementalHash ^ CreateHMAC(System::Security::Cryptography::HashAlgorithmName hashAlgorithm, ReadOnlySpan<System::Byte> key);
[System.Runtime.Versioning.UnsupportedOSPlatform("browser")]
public static System.Security.Cryptography.IncrementalHash CreateHMAC (System.Security.Cryptography.HashAlgorithmName hashAlgorithm, ReadOnlySpan<byte> key);
public static System.Security.Cryptography.IncrementalHash CreateHMAC (System.Security.Cryptography.HashAlgorithmName hashAlgorithm, ReadOnlySpan<byte> key);
[<System.Runtime.Versioning.UnsupportedOSPlatform("browser")>]
static member CreateHMAC : System.Security.Cryptography.HashAlgorithmName * ReadOnlySpan<byte> -> System.Security.Cryptography.IncrementalHash
static member CreateHMAC : System.Security.Cryptography.HashAlgorithmName * ReadOnlySpan<byte> -> System.Security.Cryptography.IncrementalHash
Public Shared Function CreateHMAC (hashAlgorithm As HashAlgorithmName, key As ReadOnlySpan(Of Byte)) As IncrementalHash

參數

hashAlgorithm
HashAlgorithmName

HMAC 內要執行的哈希演算法名稱。

key
ReadOnlySpan<Byte>

HMAC 的秘密金鑰。 索引鍵可以是任何長度,但比 hashAlgorithm 所指定的哈希演算法輸出大小更長的金鑰將會經過哈希處理(使用 hashAlgorithm指定的演算法)來衍生正確大小的密鑰。 因此,建議的秘密金鑰大小是 hashAlgorithm所指定的哈希輸出大小。

傳回

用來計算 hashAlgorithm所指定哈希演算法的哈希實例。

屬性

例外狀況

hashAlgorithmNamenull 或空字串。

hashAlgorithm 不是已知的哈希演算法。

適用於