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
| Improve this Doc 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
| Improve this Doc 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. |