HashAlgorithm.Create Metod

Definition

Skapar en instans av en implementering av en hash-algoritm.

Överlagringar

Name Description
Create()
Föråldrad.
Föråldrad.

Skapar en instans av standardimplementeringen av en hash-algoritm.

Create(String)
Föråldrad.

Skapar en instans av den angivna implementeringen av en hash-algoritm.

Create()

Källa:
HashAlgorithm.cs
Källa:
HashAlgorithm.cs
Källa:
HashAlgorithm.cs
Källa:
HashAlgorithm.cs
Källa:
HashAlgorithm.cs

Varning

The default implementation of this cryptography algorithm is not supported.

Varning

The default implementation of this cryptography algorithm is not supported

Skapar en instans av standardimplementeringen av en hash-algoritm.

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

Returer

En ny SHA1CryptoServiceProvider instans, såvida inte standardinställningarna har ändrats med hjälp av .

Attribut

Undantag

.NET Core 2.0 – 3.1 och .NET 5 och senare: I samtliga fall.

Kommentarer

Den här metoden är föråldrad i .NET 5 och senare versioner.

Som standard använder den här överlagringen implementeringen SHA1CryptoServiceProvider av en hash-algoritm. Om du vill ange en annan implementering använder du överlagringen Create(String) , vilket gör att du kan ange ett algoritmnamn i stället. Konfigurationssystemet för kryptografi definierar standardimplementeringen av HashAlgorithm.

På grund av kollisionsproblem med SHA-1 rekommenderar Microsoft en säkerhetsmodell baserad på SHA-256 eller bättre.

Gäller för

Create(String)

Källa:
HashAlgorithm.cs
Källa:
HashAlgorithm.cs
Källa:
HashAlgorithm.cs
Källa:
HashAlgorithm.cs
Källa:
HashAlgorithm.cs

Varning

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

Skapar en instans av den angivna implementeringen av en hash-algoritm.

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

Parametrar

hashName
String

Den hashalgoritmimplementering som ska användas. I följande tabell visas giltiga värden för parametern hashName och de algoritmer som de mappas till.

Parametervärde Implementerar
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

Returer

En ny instans av den angivna hash-algoritmen, eller null om hashName den inte är en giltig hash-algoritm.

Attribut

Gäller för