Class HMACUtilities
Provides methods to compute a Hash-based Message Authentication Code (HMAC).
Inherited Members
Namespace: SixLabors.ImageSharp.Web
Assembly: SixLabors.ImageSharp.Web.dll
Syntax
public static class HMACUtilities
Fields
| Edit this page View SourceTokenCommand
The command used by image requests for transporting Hash-based Message Authentication Code (HMAC) tokens.
Declaration
public const string TokenCommand = "hmac"
Field Value
Type | Description |
---|---|
string |
Methods
| Edit this page View SourceComputeHMACSHA256(string, byte[])
Computes a Hash-based Message Authentication Code (HMAC) by using the SHA256 hash function.
Declaration
public static string ComputeHMACSHA256(string value, byte[] secret)
Parameters
Type | Name | Description |
---|---|---|
string | value | The value to hash |
byte[] | secret | The secret key for HMACSHA256 encryption. The key can be any length. However, the recommended size is 64 bytes. |
Returns
Type | Description |
---|---|
string | The hashed string. |
ComputeHMACSHA384(string, byte[])
Computes a Hash-based Message Authentication Code (HMAC) by using the SHA384 hash function.
Declaration
public static string ComputeHMACSHA384(string value, byte[] secret)
Parameters
Type | Name | Description |
---|---|---|
string | value | The value to hash |
byte[] | secret | The secret key for HMACSHA256 encryption. The key can be any length. However, the recommended size is 128 bytes. |
Returns
Type | Description |
---|---|
string | The hashed string. |
ComputeHMACSHA512(string, byte[])
Computes a Hash-based Message Authentication Code (HMAC) by using the SHA512 hash function.
Declaration
public static string ComputeHMACSHA512(string value, byte[] secret)
Parameters
Type | Name | Description |
---|---|---|
string | value | The value to hash |
byte[] | secret | The secret key for HMACSHA256 encryption. The key can be any length. However, the recommended size is 128 bytes. |
Returns
Type | Description |
---|---|
string | The hashed string. |