KeyedHashAlgorithm.Create Metoda

Definicja

Tworzy wystąpienie implementacji algorytmu skrótu kluczy.

Przeciążenia

Create()
Nieaktualne.
Nieaktualne.

Tworzy wystąpienie domyślnej implementacji algorytmu skrótu kluczy.

Create(String)

Tworzy wystąpienie określonej implementacji algorytmu skrótu kluczy.

Create()

Przestroga

The default implementation of this cryptography algorithm is not supported

Przestroga

The default implementation of this cryptography algorithm is not supported.

Tworzy wystąpienie domyślnej implementacji algorytmu skrótu kluczy.

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

Zwraca

KeyedHashAlgorithm

Nowe HMACSHA1 wystąpienie, chyba że ustawienia domyślne zostały zmienione.

Atrybuty

Uwagi

Domyślnie to przeciążenie używa implementacji HMACSHA1 algorytmu skrótu kluczy. Jeśli chcesz określić inną implementację, użyj Create(String) przeciążenia, które pozwala określić nazwę algorytmu, zamiast tego. System konfiguracji kryptografii definiuje domyślną implementację KeyedHashAlgorithm klasy.

Ze względu na problemy z kolizją z algorytmem SHA1 firma Microsoft zaleca model zabezpieczeń oparty na algorytmie SHA256 lub lepszym.

Zobacz też

Dotyczy

Create(String)

Tworzy wystąpienie określonej implementacji algorytmu skrótu kluczy.

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

Parametry

algName
String

Implementacja algorytmu skrótu kluczy do użycia. W poniższej tabeli przedstawiono prawidłowe wartości parametru algName i algorytmy, na które mapują.

Wartość parametru Implementuje
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

Zwraca

KeyedHashAlgorithm

Nowe wystąpienie określonego algorytmu skrótu klucza.

Wyjątki

.NET Core 2.0 — 3.1 i .NET 5 i nowsze: we wszystkich przypadkach.

Uwagi

Ta metoda jest przestarzała na platformie .NET 5 i nowszych wersjach.

Ta metoda obsługuje wiele algorytmów, w tym MD5, SHA-1, SHA-256 i RIPEMD160. Aby uzyskać pełną listę, zobacz obsługiwane wartości parametru algName .

Zobacz też

Dotyczy