Click or drag to resize

HmacHexFromBytes Method

Create a keyed-hash HMAC in hex-encoded format from byte input.

Namespace: CryptoSysPKI
Assembly: diCrSysPKINet (in diCrSysPKINet.dll) Version: 23.0.0.25611 (23.0.0.0)
Syntax
public static string HexFromBytes(
	byte[] message,
	byte[] key,
	HashAlgorithm hashAlg
)

Parameters

message  Byte
Message to be signed in byte format
key  Byte
Key in byte format
hashAlg  HashAlgorithm
Hash algorithm to be used

Return Value

String
HMAC in hex-encoded format
Example
C#
// Hmac of <Test Case 1> with input in hex format
string s = Hmac.HexFromHex("4869205468657265", "0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b", HashAlgorithm.Sha256);
Console.WriteLine("HMAC-SHA-256('Hi There', (0x0b)*20)=\n{0}", s);
// b0344c61d8db38535ca8afceaf0bf12b881dc200c9833da726e9376c2e32cff7
See Also