KeyedHashAlgorithm.Create 方法

定义

创建键控哈希算法实现的实例。

重载

名称 说明
Create()
已过时.
已过时.

创建键控哈希算法的默认实现的实例。

Create(String)
已过时.

创建键控哈希算法的指定实现的实例。

Create()

Source:
KeyedHashAlgorithm.cs
Source:
KeyedHashAlgorithm.cs
Source:
KeyedHashAlgorithm.cs
Source:
KeyedHashAlgorithm.cs
Source:
KeyedHashAlgorithm.cs

注意

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) 重载,从而指定算法名称。 加密配置系统定义类的默认实现 KeyedHashAlgorithm

由于 SHA-1 冲突问题,Microsoft建议基于 SHA-256 或更高版本的安全模型。

另请参阅

适用于

Create(String)

Source:
KeyedHashAlgorithm.cs
Source:
KeyedHashAlgorithm.cs
Source:
KeyedHashAlgorithm.cs
Source:
KeyedHashAlgorithm.cs
Source:
KeyedHashAlgorithm.cs

注意

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
System.Security.Cryptography.HMACMD5 HMACMD5
HMACRIPEMD160 HMACRIPEMD160
System.Security.Cryptography.HMACRIPEMD160 HMACRIPEMD160
HMACSHA1 HMACSHA1
System.Security.Cryptography.HMACSHA1 HMACSHA1
HMACSHA256 HMACSHA256
System.Security.Cryptography.HMACSHA256 HMACSHA256
HMACSHA384 HMACSHA384
System.Security.Cryptography.HMACSHA384 HMACSHA384
HMACSHA512 HMACSHA512
System.Security.Cryptography.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

另请参阅

适用于