HashAlgorithm.Create Метод

Определение

Создает экземпляр реализации хэш-алгоритма.

Перегрузки

Имя Описание
Create()
Устаревшие..
Устаревшие..

Создает экземпляр реализации хэш-алгоритма по умолчанию.

Create(String)
Устаревшие..

Создает экземпляр указанной реализации хэш-алгоритма.

Create()

Исходный код:
HashAlgorithm.cs
Исходный код:
HashAlgorithm.cs
Исходный код:
HashAlgorithm.cs
Исходный код:
HashAlgorithm.cs
Исходный код:
HashAlgorithm.cs

Внимание

The default implementation of this cryptography algorithm is not supported.

Внимание

The default implementation of this cryptography algorithm is not supported

Создает экземпляр реализации хэш-алгоритма по умолчанию.

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

Возвращаемое значение

Новый SHA1CryptoServiceProvider экземпляр, если параметры по умолчанию не были изменены с помощью .

Атрибуты

Исключения

.NET Core 2.0 – 3.1 и .NET 5 и более поздних версий: во всех случаях.

Комментарии

Этот метод устарел в .NET 5 и более поздних версиях.

По умолчанию эта перегрузка использует SHA1CryptoServiceProvider реализацию хэш-алгоритма. Если вы хотите указать другую реализацию, используйте Create(String) перегрузку, которая позволяет указать имя алгоритма. Система конфигурации шифрования определяет реализацию HashAlgorithmпо умолчанию.

Из-за проблем с столкновением с SHA-1 корпорация Майкрософт рекомендует модель безопасности на основе SHA-256 или более поздней версии.

Применяется к

Create(String)

Исходный код:
HashAlgorithm.cs
Исходный код:
HashAlgorithm.cs
Исходный код:
HashAlgorithm.cs
Исходный код:
HashAlgorithm.cs
Исходный код:
HashAlgorithm.cs

Внимание

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

Создает экземпляр указанной реализации хэш-алгоритма.

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

Параметры

hashName
String

Используемая реализация хэш-алгоритма. В следующей hashName таблице показаны допустимые значения для параметра и алгоритмов, с которые они сопоставляются.

Значение параметра Реализует
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

Возвращаемое значение

Новый экземпляр указанного хэш-алгоритма или null недопустимый hashName хэш-алгоритм.

Атрибуты

Применяется к