Create a keyed-hash HMAC in hex-encoded format from byte input.
Namespace: CryptoSysPKIAssembly: diCrSysPKINet (in diCrSysPKINet.dll) Version: 23.0.0.25611 (23.0.0.0)
Syntaxpublic static string HexFromBytes(
byte[] message,
byte[] key,
HashAlgorithm hashAlg
)
Public Shared Function HexFromBytes (
message As Byte(),
key As Byte(),
hashAlg As HashAlgorithm
) As String
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
StringHMAC in hex-encoded format
Example
string s = Hmac.HexFromHex("4869205468657265", "0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b", HashAlgorithm.Sha256);
Console.WriteLine("HMAC-SHA-256('Hi There', (0x0b)*20)=\n{0}", s);
See Also