KeyedHashAlgorithm.Create Метод

Определение

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

Перегрузки

Create()
Является устаревшей.
Является устаревшей.

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

Create(String)

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

Create()

Внимание!

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

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

KeyedHashAlgorithm

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

Атрибуты

Комментарии

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

Из-за проблем с SHA1 корпорация Майкрософт рекомендует использовать модель безопасности на основе SHA256 или более высокого уровня.

См. также раздел

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

Create(String)

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

public:
 static System::Security::Cryptography::KeyedHashAlgorithm ^ Create(System::String ^ algName);
public static System.Security.Cryptography.KeyedHashAlgorithm? Create (string algName);
public static System.Security.Cryptography.KeyedHashAlgorithm Create (string algName);
static member Create : string -> System.Security.Cryptography.KeyedHashAlgorithm
Public Shared Function Create (algName As String) As KeyedHashAlgorithm

Параметры

algName
String

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

Значение параметра Инструменты
System.Security.Cryptography.HMAC HMACSHA1
System.Security.Cryptography.KeyedHashAlgorithm HMACSHA1
HMACMD5 HMACMD5
System.Security.Cryptography.HMACMD5 HMACMD5
HMACRIPEMD160 HMACRIPEMD160
System.Security.Cryptography.HMACRIPEMD160 HMACRIPEMD160
HMACSHA1 HMACSHA1
System.Security.Cryptography.HMACSHA1 HMACSHA1
HMACSHA256 HMACSHA256
System.Security.Cryptography.HMACSHA256 HMACSHA256
HMACSHA384 HMACSHA384
System.Security.Cryptography.HMACSHA384 HMACSHA384
HMACSHA512 HMACSHA512
System.Security.Cryptography.HMACSHA512 HMACSHA512
MACTripleDES MACTripleDES
System.Security.Cryptography.MACTripleDES MACTripleDES

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

KeyedHashAlgorithm

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

Исключения

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

Комментарии

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

Этот метод поддерживает ряд алгоритмов, включая MD5, SHA-1, SHA-256 и RIPEMD160. Полный список см. в поддерживаемых значениях параметра algName .

См. также раздел

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