HashAlgorithm.Create Método

Definição

Cria uma instância de uma implementação de um algoritmo de hash.

Sobrecargas

Nome Description
Create()
Obsoleto.
Obsoleto.

Cria uma instância da implementação padrão de um algoritmo de hash.

Create(String)
Obsoleto.

Cria uma instância da implementação especificada de um algoritmo de hash.

Create()

Origem:
HashAlgorithm.cs
Origem:
HashAlgorithm.cs
Origem:
HashAlgorithm.cs
Origem:
HashAlgorithm.cs
Origem:
HashAlgorithm.cs

Cuidado

The default implementation of this cryptography algorithm is not supported.

Cuidado

The default implementation of this cryptography algorithm is not supported

Cria uma instância da implementação padrão de um algoritmo de 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

Retornos

Uma nova SHA1CryptoServiceProvider instância, a menos que as configurações padrão tenham sido alteradas usando o .

Atributos

Exceções

.NET Core 2.0 – 3.1 e .NET 5 e posterior: em todos os casos.

Comentários

Esse método é obsoleto em versões .NET 5 e posteriores.

Por padrão, essa sobrecarga usa a SHA1CryptoServiceProvider implementação de um algoritmo de hash. Se você quiser especificar uma implementação diferente, use a Create(String) sobrecarga, que permite especificar um nome de algoritmo. O sistema de configuração de criptografia define a implementação padrão de HashAlgorithm.

Devido a problemas de colisão com SHA-1, a Microsoft recomenda um modelo de segurança baseado no SHA-256 ou superior.

Aplica-se a

Create(String)

Origem:
HashAlgorithm.cs
Origem:
HashAlgorithm.cs
Origem:
HashAlgorithm.cs
Origem:
HashAlgorithm.cs
Origem:
HashAlgorithm.cs

Cuidado

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

Cria uma instância da implementação especificada de um algoritmo de hash.

public:
 static System::Security::Cryptography::HashAlgorithm ^ Create(System::String ^ hashName);
[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.HashAlgorithm? Create(string hashName);
public static System.Security.Cryptography.HashAlgorithm? Create(string hashName);
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("The default algorithm implementations might be removed, use strong type references like 'RSA.Create()' instead.")]
public static System.Security.Cryptography.HashAlgorithm? Create(string hashName);
public static System.Security.Cryptography.HashAlgorithm Create(string hashName);
[<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.HashAlgorithm
static member Create : string -> System.Security.Cryptography.HashAlgorithm
[<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.HashAlgorithm
Public Shared Function Create (hashName As String) As HashAlgorithm

Parâmetros

hashName
String

A implementação do algoritmo de hash a ser usada. A tabela a seguir mostra os valores válidos para o hashName parâmetro e os algoritmos para os quais eles mapeiam.

Valor do parâmetro Implementa
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

Retornos

Uma nova instância do algoritmo de hash especificado ou null se hashName não for um algoritmo de hash válido.

Atributos

Aplica-se a