IncrementalHash.CreateHMAC 方法

定義

多載

CreateHMAC(HashAlgorithmName, Byte[])

為使用指定的雜湊演算法和金鑰的雜湊訊息驗證碼 (HMAC) 演算法建立 IncrementalHash

CreateHMAC(HashAlgorithmName, ReadOnlySpan<Byte>)

使用由 hashAlgorithm 指定的雜湊演算法,以及由 key 指定的金鑰,為雜湊式訊息驗證碼 (HMAC) 演算法建立 IncrementalHash

CreateHMAC(HashAlgorithmName, Byte[])

為使用指定的雜湊演算法和金鑰的雜湊訊息驗證碼 (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 的祕密金鑰。 金鑰可為任意長度,但超過指定雜湊演算法輸出大小的金鑰會被雜湊,以衍生大小正確的金鑰。 因此,建議的祕密金鑰大小是指定的雜湊演算法輸出大小。

傳回

IncrementalHash

隨時可計算指定雜湊演算法的IncrementalHash 類別的執行個體。

屬性

例外狀況

keynull

hashAlgorithm.Namenull 或空字串。

hashAlgorithm 不是已知的雜湊演算法。

適用於

CreateHMAC(HashAlgorithmName, ReadOnlySpan<Byte>)

使用由 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 指定的雜湊輸出大小。

傳回

IncrementalHash

hashAlgorithm 指定來計算雜湊演算法的雜湊執行個體。

屬性

例外狀況

hashAlgorithm.Namenull 或空字串。

hashAlgorithm 不是已知的雜湊演算法。

適用於