Compartir a través de


HashAlgorithm.Create Método

Definición

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

Sobrecargas

Create()
Obsoletos.
Obsoletos.

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

Create(String)
Obsoletos.

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

Create()

Source:
HashAlgorithm.cs
Source:
HashAlgorithm.cs
Source:
HashAlgorithm.cs

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

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)

Source:
HashAlgorithm.cs
Source:
HashAlgorithm.cs
Source:
HashAlgorithm.cs

Precaución

Cryptographic factory methods accepting an algorithm name are obsolete. Use the parameterless Create factory method on the algorithm type instead.

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);
[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.HashAlgorithm? Create (string hashName);
public static System.Security.Cryptography.HashAlgorithm Create (string hashName);
static member Create : string -> System.Security.Cryptography.HashAlgorithm
[<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.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
SHASHA1CryptoServiceProvider
SHA1SHA1CryptoServiceProvider
System.Security.Cryptography.SHA1SHA1CryptoServiceProvider
System.Security.Cryptography.HashAlgorithmSHA1CryptoServiceProvider
MD5MD5CryptoServiceProvider
System.Security.Cryptography.MD5MD5CryptoServiceProvider
SHA256SHA256Managed
SHA-256SHA256Managed
System.Security.Cryptography.SHA256SHA256Managed
SHA384SHA384Managed
SHA-384SHA384Managed
System.Security.Cryptography.SHA384SHA384Managed
SHA512SHA512Managed
SHA-512SHA512Managed
System.Security.Cryptography.SHA512SHA512Managed

Devoluciones

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

Atributos

Se aplica a