Class HmacUtility
This utility class is designed to make HMAC (Hash-based Message Authentication Code) System.Security.Cryptography.KeyedHashAlgorithm operations easier to work with.
Inheritance
Namespace: Cuemon.Security.Cryptography
Assembly: Cuemon.Security.dll
Syntax
public static class HmacUtility
Methods
| Improve this DocComputeKeyedHash(Byte[], Byte[], Action<KeyedHashOptions>)
Computes a keyed-hash value of the specified value
.
Declaration
public static HashResult ComputeKeyedHash(byte[] value, byte[] sharedKey, Action<KeyedHashOptions> setup = null)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | value | The System.Byte array to compute a hash code for. |
System.Byte[] | sharedKey | The secret key for the hashed encryption. The key can be any length, but it is strongly recommended to use a size of either 64 bytes (for SHA1 and SHA256) or 128 bytes (for SHA384 and SHA512). |
System.Action<KeyedHashOptions> | setup | The KeyedHashOptions which need to be configured. |
Returns
Type | Description |
---|---|
HashResult | A HashResult containing the computed keyed-hash value of the specified |
ComputeKeyedHash(Stream, Byte[], Action<StreamKeyedHashOptions>)
Computes a keyed-hash value of the specified value
.
Declaration
public static HashResult ComputeKeyedHash(Stream value, byte[] sharedKey, Action<StreamKeyedHashOptions> setup = null)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | value | The System.IO.Stream to compute a hash code for. |
System.Byte[] | sharedKey | The secret key for the hashed encryption. The key can be any length, but it is strongly recommended to use a size of either 64 bytes (for SHA1 and SHA256) or 128 bytes (for SHA384 and SHA512). |
System.Action<StreamKeyedHashOptions> | setup | The StreamKeyedHashOptions which need to be configured. |
Returns
Type | Description |
---|---|
HashResult | A HashResult containing the computed keyed-hash value of the specified |
ComputeKeyedHash(Object, Byte[], Action<KeyedHashOptions>)
Computes a keyed-hash value of the specified value
.
Declaration
public static HashResult ComputeKeyedHash(object value, byte[] sharedKey, Action<KeyedHashOptions> setup = null)
Parameters
Type | Name | Description |
---|---|---|
System.Object | value | The object to compute a hash code for. |
System.Byte[] | sharedKey | The secret key for the hashed encryption. The key can be any length, but it is strongly recommended to use a size of either 64 bytes (for SHA1 and SHA256) or 128 bytes (for SHA384 and SHA512). |
System.Action<KeyedHashOptions> | setup | The KeyedHashOptions which need to be configured. |
Returns
Type | Description |
---|---|
HashResult | A HashResult containing the computed keyed-hash value of the specified |
ComputeKeyedHash(Object[], Byte[], Action<KeyedHashOptions>)
Combines a sequence of objects into one object, and computes a keyed-hash value of the specified values
.
Declaration
public static HashResult ComputeKeyedHash(object[] values, byte[] sharedKey, Action<KeyedHashOptions> setup = null)
Parameters
Type | Name | Description |
---|---|---|
System.Object[] | values | The objects to compute a hash code for. |
System.Byte[] | sharedKey | The secret key for the hashed encryption. The key can be any length, but it is strongly recommended to use a size of either 64 bytes (for SHA1 and SHA256) or 128 bytes (for SHA384 and SHA512). |
System.Action<KeyedHashOptions> | setup | The KeyedHashOptions which need to be configured. |
Returns
Type | Description |
---|---|
HashResult | A HashResult containing the computed keyed-hash value of the specified |
ComputeKeyedHash(String, Byte[], Action<StringKeyedHashOptions>)
Computes a keyed-hash value of the specified value
.
Declaration
public static HashResult ComputeKeyedHash(string value, byte[] sharedKey, Action<StringKeyedHashOptions> setup = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | value | The System.String value to compute a hash code for. |
System.Byte[] | sharedKey | The secret key for the hashed encryption. The key can be any length, but it is strongly recommended to use a size of either 64 bytes (for SHA1 and SHA256) or 128 bytes (for SHA384 and SHA512). |
System.Action<StringKeyedHashOptions> | setup | The StringKeyedHashOptions which need to be configured. |
Returns
Type | Description |
---|---|
HashResult | A HashResult containing the computed keyed-hash value of the specified |
ComputeKeyedHash(String[], Byte[], Action<StringKeyedHashOptions>)
Computes a keyed-hash value of the specified values
.
Declaration
public static HashResult ComputeKeyedHash(string[] values, byte[] sharedKey, Action<StringKeyedHashOptions> setup = null)
Parameters
Type | Name | Description |
---|---|---|
System.String[] | values | The System.String array to compute a hash code for. |
System.Byte[] | sharedKey | The secret key for the hashed encryption. The key can be any length, but it is strongly recommended to use a size of either 64 bytes (for SHA1 and SHA256) or 128 bytes (for SHA384 and SHA512). |
System.Action<StringKeyedHashOptions> | setup | The StringKeyedHashOptions which need to be configured. |
Returns
Type | Description |
---|---|
HashResult | A HashResult containing the computed keyed-hash value of |