HashAlgorithm.Create HashAlgorithm.Create HashAlgorithm.Create HashAlgorithm.Create Method

定义

创建哈希算法实现的实例。Creates an instance of an implementation of a hash algorithm.

重载

Create() Create() Create() Create()

创建哈希算法的默认实现的实例。Creates an instance of the default implementation of a hash algorithm.

Create(String) Create(String) Create(String) Create(String)

创建哈希算法的指定实现的实例。Creates an instance of the specified implementation of a hash algorithm.

Create() Create() Create() Create()

创建哈希算法的默认实现的实例。Creates an instance of the default implementation of a hash algorithm.

public:
 static System::Security::Cryptography::HashAlgorithm ^ Create();
public static System.Security.Cryptography.HashAlgorithm Create ();
static member Create : unit -> System.Security.Cryptography.HashAlgorithm
Public Shared Function Create () As HashAlgorithm

返回

一个新的 SHA1CryptoServiceProvider 实例,除非已使用更改默认设置。A new SHA1CryptoServiceProvider instance, unless the default settings have been changed using the .

注解

默认情况下,此重载使用SHA1CryptoServiceProvider哈希算法的实现。By default, this overload uses the SHA1CryptoServiceProvider implementation of a hash algorithm. 如果要指定其他实现,请使用Create(String)重载,该重载使您可以改为指定算法名称。If you want to specify a different implementation, use the Create(String) overload, which lets you specify an algorithm name, instead. 加密配置系统定义的HashAlgorithm默认实现。The cryptography configuration system defines the default implementation of HashAlgorithm.

由于 SHA1 出现冲突问题,Microsoft 建议使用基于 SHA256 或更好的安全模型。Due to collision problems with SHA1, Microsoft recommends a security model based on SHA256 or better.

Create(String) Create(String) Create(String) Create(String)

创建哈希算法的指定实现的实例。Creates an instance of the specified implementation of a hash algorithm.

public:
 static System::Security::Cryptography::HashAlgorithm ^ Create(System::String ^ hashName);
public static System.Security.Cryptography.HashAlgorithm Create (string hashName);
static member Create : string -> System.Security.Cryptography.HashAlgorithm
Public Shared Function Create (hashName As String) As HashAlgorithm

参数

hashName
String String String String

要使用的哈希算法的实现。The hash algorithm implementation to use. 下表显示 hashName 参数的有效值以及它们映射到的算法。The following table shows the valid values for the hashName parameter and the algorithms they map to.

参数值Parameter value 实现为其类型参数Implements
SHASHA SHA1CryptoServiceProvider
SHA1SHA1 SHA1CryptoServiceProvider
System.Security.Cryptography.SHA1System.Security.Cryptography.SHA1 SHA1CryptoServiceProvider
System.Security.Cryptography.HashAlgorithmSystem.Security.Cryptography.HashAlgorithm SHA1CryptoServiceProvider
MD5MD5 MD5CryptoServiceProvider
System.Security.Cryptography.MD5System.Security.Cryptography.MD5 MD5CryptoServiceProvider
SHA256SHA256 SHA256Managed
SHA-256SHA-256 SHA256Managed
System.Security.Cryptography.SHA256System.Security.Cryptography.SHA256 SHA256Managed
SHA384SHA384 SHA384Managed
SHA-384SHA-384 SHA384Managed
System.Security.Cryptography.SHA384System.Security.Cryptography.SHA384 SHA384Managed
SHA512SHA512 SHA512Managed
SHA-512SHA-512 SHA512Managed
System.Security.Cryptography.SHA512System.Security.Cryptography.SHA512 SHA512Managed

返回

所指定哈希算法,或 null 的新实例,如果 hashName 不是有效哈希算法。A new instance of the specified hash algorithm, or null if hashName is not a valid hash algorithm.

适用于