KeyedHashAlgorithm.Create 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
建立一個鍵控雜湊演算法實作的實例。
多載
| 名稱 | Description |
|---|---|
| Create() |
已淘汰.
已淘汰.
建立一個鍵控雜湊演算法預設實作的實例。 |
| Create(String) |
已淘汰.
建立指定實作的鍵控雜湊演算法實例。 |
Create()
警告
The default implementation of this cryptography algorithm is not supported.
警告
The default implementation of this cryptography algorithm is not supported
建立一個鍵控雜湊演算法預設實作的實例。
public:
static System::Security::Cryptography::KeyedHashAlgorithm ^ Create();
[System.Obsolete("The default implementation of this cryptography algorithm is not supported.", DiagnosticId="SYSLIB0007", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public static System.Security.Cryptography.KeyedHashAlgorithm Create();
[System.Obsolete("The default implementation of this cryptography algorithm is not supported", DiagnosticId="SYSLIB0007", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public static System.Security.Cryptography.KeyedHashAlgorithm Create();
public static System.Security.Cryptography.KeyedHashAlgorithm Create();
[<System.Obsolete("The default implementation of this cryptography algorithm is not supported.", DiagnosticId="SYSLIB0007", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
static member Create : unit -> System.Security.Cryptography.KeyedHashAlgorithm
[<System.Obsolete("The default implementation of this cryptography algorithm is not supported", DiagnosticId="SYSLIB0007", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
static member Create : unit -> System.Security.Cryptography.KeyedHashAlgorithm
static member Create : unit -> System.Security.Cryptography.KeyedHashAlgorithm
Public Shared Function Create () As KeyedHashAlgorithm
傳回
一個新的 HMACSHA1 實例,除非預設設定被更改。
- 屬性
備註
預設情況下,此超載會實 HMACSHA1 作鍵控雜湊演算法。 如果你想指定不同的實作,可以用 Create(String) overload,這樣可以指定演算法名稱。 密碼學配置系統定義了該 KeyedHashAlgorithm 類別的預設實作。
由於 SHA-1 發生衝突問題,Microsoft 建議採用基於 SHA-256 或更高層級的安全性模型。
另請參閱
適用於
Create(String)
警告
Cryptographic factory methods accepting an algorithm name are obsolete. Use the parameterless Create factory method on the algorithm type instead.
建立指定實作的鍵控雜湊演算法實例。
public:
static System::Security::Cryptography::KeyedHashAlgorithm ^ Create(System::String ^ algName);
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("The default algorithm implementations might be removed, use strong type references like 'RSA.Create()' instead.")]
[System.Obsolete("Cryptographic factory methods accepting an algorithm name are obsolete. Use the parameterless Create factory method on the algorithm type instead.", DiagnosticId="SYSLIB0045", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public static System.Security.Cryptography.KeyedHashAlgorithm? Create(string algName);
public static System.Security.Cryptography.KeyedHashAlgorithm? Create(string algName);
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("The default algorithm implementations might be removed, use strong type references like 'RSA.Create()' instead.")]
public static System.Security.Cryptography.KeyedHashAlgorithm? Create(string algName);
public static System.Security.Cryptography.KeyedHashAlgorithm Create(string algName);
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("The default algorithm implementations might be removed, use strong type references like 'RSA.Create()' instead.")>]
[<System.Obsolete("Cryptographic factory methods accepting an algorithm name are obsolete. Use the parameterless Create factory method on the algorithm type instead.", DiagnosticId="SYSLIB0045", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
static member Create : string -> System.Security.Cryptography.KeyedHashAlgorithm
static member Create : string -> System.Security.Cryptography.KeyedHashAlgorithm
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("The default algorithm implementations might be removed, use strong type references like 'RSA.Create()' instead.")>]
static member Create : string -> System.Security.Cryptography.KeyedHashAlgorithm
Public Shared Function Create (algName As String) As KeyedHashAlgorithm
參數
- algName
- String
鍵控雜湊演算法實作。 下表顯示參數 algName 的有效值及其映射演算法。
| 參數值 | 工具 |
|---|---|
| System.Security.Cryptography.HMAC | HMACSHA1 |
| System.Security.Cryptography.KeyedHashAlgorithm | HMACSHA1 |
| HMACMD5 | HMACMD5 |
| 系統.安全.密碼學.HMACMD5 | HMACMD5 |
| HMACRIPEMD160 | HMACRIPEMD160 |
| 系統.安全.密碼學.HMACRIPEMD160 | HMACRIPEMD160 |
| HMACSHA1 | HMACSHA1 |
| 系統.安全.密碼學.HMACSHA1 | HMACSHA1 |
| HMACSHA256 | HMACSHA256 |
| 系統.安全.密碼學.HMACSHA256 | HMACSHA256 |
| HMACSHA384 | HMACSHA384 |
| 系統.安全.密碼學.HMACSHA384 | HMACSHA384 |
| HMACSHA512 | HMACSHA512 |
| 系統。安全。密碼學。HMACSHA512 | HMACSHA512 |
| MACTripleDES | MACTripleDES |
| System.Security.Cryptography.MACTripleDES | MACTripleDES |
傳回
指定鍵控雜湊演算法的新實例。
- 屬性
例外狀況
.NET Core 2.0 - 3.1 及 .NET 5 及以後版本:適用於所有版本。
備註
此方法在 .NET 5 及更新版本中已過時。
此方法支援多種演算法,包括 MD5、SHA-1、SHA-256 及 RIPEMD160。 完整列表請參閱參數的支援值 algName 。