Table of Contents

Class HMACUtilities

Namespace
SixLabors.ImageSharp.Web
Assembly
SixLabors.ImageSharp.Web.dll

Provides methods to compute a Hash-based Message Authentication Code (HMAC).

public static class HMACUtilities
Inheritance
HMACUtilities
Inherited Members

Fields

TokenCommand

The command used by image requests for transporting Hash-based Message Authentication Code (HMAC) tokens.

public const string TokenCommand = "hmac"

Field Value

string

Methods

ComputeHMACSHA256(string, byte[])

Computes a Hash-based Message Authentication Code (HMAC) by using the SHA256 hash function.

public static string ComputeHMACSHA256(string value, byte[] secret)

Parameters

value string

The value to hash

secret byte[]

The secret key for HMACSHA256 encryption. The key can be any length. However, the recommended size is 64 bytes.

Returns

string

The hashed string.

ComputeHMACSHA384(string, byte[])

Computes a Hash-based Message Authentication Code (HMAC) by using the SHA384 hash function.

public static string ComputeHMACSHA384(string value, byte[] secret)

Parameters

value string

The value to hash

secret byte[]

The secret key for HMACSHA256 encryption. The key can be any length. However, the recommended size is 128 bytes.

Returns

string

The hashed string.

ComputeHMACSHA512(string, byte[])

Computes a Hash-based Message Authentication Code (HMAC) by using the SHA512 hash function.

public static string ComputeHMACSHA512(string value, byte[] secret)

Parameters

value string

The value to hash

secret byte[]

The secret key for HMACSHA256 encryption. The key can be any length. However, the recommended size is 128 bytes.

Returns

string

The hashed string.