HashAlgorithm.Create Método

Definición

Crea una instancia de una implementación de un algoritmo hash.

Sobrecargas

Create()
Obsoleto.
Obsoleto.

Crea una instancia de la implementación predeterminada de un algoritmo hash.

Create(String)

Crea una instancia de la implementación especificada de un algoritmo hash.

Create()

Precaución

The default implementation of this cryptography algorithm is not supported

Precaución

The default implementation of this cryptography algorithm is not supported.

Crea una instancia de la implementación predeterminada de un algoritmo hash.

public:
 static System::Security::Cryptography::HashAlgorithm ^ 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.HashAlgorithm 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.HashAlgorithm Create ();
public static System.Security.Cryptography.HashAlgorithm 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.HashAlgorithm
[<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.HashAlgorithm
static member Create : unit -> System.Security.Cryptography.HashAlgorithm
Public Shared Function Create () As HashAlgorithm

Devoluciones

HashAlgorithm

Una nueva instancia de SHA1CryptoServiceProvider, a menos que la configuración predeterminada se haya cambiado usando .

Atributos

Excepciones

.NET Core 2.0 - 3.1 y .NET 5 y versiones posteriores: en todos los casos.

Comentarios

Este método está obsoleto en .NET 5 y versiones posteriores.

De forma predeterminada, esta sobrecarga usa la SHA1CryptoServiceProvider implementación de un algoritmo hash. Si desea especificar una implementación diferente, use la Create(String) sobrecarga , que le permite especificar un nombre de algoritmo, en su lugar. El sistema de configuración de criptografía define la implementación predeterminada de HashAlgorithm.

Debido a problemas de colisión con SHA1, Microsoft recomienda un modelo de seguridad basado en SHA256 o mejor.

Se aplica a

Create(String)

Crea una instancia de la implementación especificada de un algoritmo hash.

public:
 static System::Security::Cryptography::HashAlgorithm ^ Create(System::String ^ hashName);
public static System.Security.Cryptography.HashAlgorithm? Create (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

Parámetros

hashName
String

La implementación de algoritmo hash a usar. En la tabla siguiente se muestran los valores válidos para el parámetro hashName y los algoritmos a los que se asignan.

Valor de parámetro Implementaciones
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

Devoluciones

HashAlgorithm

Una nueva instancia del algoritmo hash especificado, o null si hashName no es un algoritmo hash válido.

Se aplica a