IncrementalHash.CreateHMAC 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
多載
CreateHMAC(HashAlgorithmName, Byte[]) |
為使用指定的雜湊演算法和金鑰的雜湊訊息驗證碼 (HMAC) 演算法建立 IncrementalHash。 |
CreateHMAC(HashAlgorithmName, ReadOnlySpan<Byte>) |
使用由 |
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 類別的執行個體。
- 屬性
例外狀況
key
為 null
。
hashAlgorithm
.Name 是 null
或空字串。
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
指定的雜湊輸出大小。
傳回
由 hashAlgorithm
指定來計算雜湊演算法的雜湊執行個體。
- 屬性
例外狀況
hashAlgorithm
。Name 為 null
或空字串。
hashAlgorithm
不是已知的雜湊演算法。
適用於
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應