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

Definition

Creates an instance of an implementation of a hash algorithm.

Overloads

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

Returns

A new SHA1CryptoServiceProvider instance, unless the default settings have been changed using the .

Remarks

By default, this overload uses the SHA1CryptoServiceProvider implementation of a hash algorithm. If you want to specify a different implementation, use the Create(String) overload, which lets you specify an algorithm name, instead. The cryptography configuration system defines the default implementation of HashAlgorithm.

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

Parameters

hashName
String String String String

The hash algorithm implementation to use. The following table shows the valid values for the hashName parameter and the algorithms they map to.

Parameter value Implements
SHA SHA1CryptoServiceProvider
SHA1 SHA1CryptoServiceProvider
System.Security.Cryptography.SHA1 SHA1CryptoServiceProvider
System.Security.Cryptography.HashAlgorithm SHA1CryptoServiceProvider
MD5 MD5CryptoServiceProvider
System.Security.Cryptography.MD5 MD5CryptoServiceProvider
SHA256 SHA256Managed
SHA-256 SHA256Managed
System.Security.Cryptography.SHA256 SHA256Managed
SHA384 SHA384Managed
SHA-384 SHA384Managed
System.Security.Cryptography.SHA384 SHA384Managed
SHA512 SHA512Managed
SHA-512 SHA512Managed
System.Security.Cryptography.SHA512 SHA512Managed

Returns

A new instance of the specified hash algorithm, or null if hashName is not a valid hash algorithm.

Applies to