Ask Learn
Preview
Ask Learn is an AI assistant that can answer questions, clarify concepts, and define terms using trusted Microsoft documentation.
Please sign in to use Ask Learn.
Sign inThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Creates an instance of an implementation of a Hash-based Message Authentication Code (HMAC) .
Create() |
Obsolete.
Obsolete.
Creates an instance of the default implementation of a Hash-based Message Authentication Code (HMAC). |
Create(String) |
Obsolete.
Creates an instance of the specified implementation of a Hash-based Message Authentication Code (HMAC). |
Caution
The default implementation of this cryptography algorithm is not supported.
Caution
The default implementation of this cryptography algorithm is not supported
Creates an instance of the default implementation of a Hash-based Message Authentication Code (HMAC).
public:
static System::Security::Cryptography::HMAC ^ 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.HMAC 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.HMAC Create();
public static System.Security.Cryptography.HMAC 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.HMAC
[<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.HMAC
static member Create : unit -> System.Security.Cryptography.HMAC
Public Shared Function Create () As HMAC
A new SHA-1 instance, unless the default settings have been changed by using the <cryptoClass> element.
.NET Core 2.0 - 3.1 and .NET 5 and later: In all cases.
This method is obsolete in .NET 5 and later versions.
By default, this overload uses the SHA-1 implementation of HMAC. If you want to specify a different implementation, use the Create(String) overload, which lets you specify an algorithm name, instead.
Due to collision problems with SHA-1, Microsoft recommends a security model based on SHA-256 or better.
Product | Versions (Obsolete) |
---|---|
.NET | Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1 (5, 6, 7, 8, 9, 10) |
.NET Framework | 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 2.0, 2.1 |
Caution
Cryptographic factory methods accepting an algorithm name are obsolete. Use the parameterless Create factory method on the algorithm type instead.
Creates an instance of the specified implementation of a Hash-based Message Authentication Code (HMAC).
public:
static System::Security::Cryptography::HMAC ^ Create(System::String ^ algorithmName);
[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.HMAC? Create(string algorithmName);
public static System.Security.Cryptography.HMAC? Create(string algorithmName);
public static System.Security.Cryptography.HMAC Create(string algorithmName);
[<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.HMAC
static member Create : string -> System.Security.Cryptography.HMAC
Public Shared Function Create (algorithmName As String) As HMAC
The HMAC implementation to use. The following table shows the valid values for the algorithmName
parameter and the algorithms they map to.
Parameter value | Implements |
---|---|
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 |
A new instance of the specified HMAC implementation.
HMAC supports a number of hash algorithms, including MD5, SHA-1, SHA-256, and RIPEMD160. For the full list, see the supported values for the algorithmName
parameter.
Due to collision problems with MD5 and SHA-1, Microsoft recommends a security model based on SHA-256 or better.
Product | Versions (Obsolete) |
---|---|
.NET | Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6 (7, 8, 9, 10) |
.NET Framework | 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 2.0, 2.1 |
.NET feedback
.NET is an open source project. Select a link to provide feedback:
Ask Learn is an AI assistant that can answer questions, clarify concepts, and define terms using trusted Microsoft documentation.
Please sign in to use Ask Learn.
Sign in