CryptoSys PKI Pro Manual

Hmac.HexFromBytes Method

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

Syntax

[C#]
public static string HexFromBytes(
   byte[] message,
   byte[] key,
   HashAlgorithm hashAlg 
)
[VB]
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

String
HMAC in hex-encoded format

Example

// 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

VB6/C equivalent: HMAC_HexFromBytes

[Contents] [Index]

[PREV: Hmac.BytesFromBytes Method...]   [Contents]   [Index]   
   [NEXT: Hmac.HexFromHex Method...]

Copyright © 2004-26 D.I. Management Services Pty Ltd t/a CryptoSys. All rights reserved. Generated 2026-09-21T05:59:39Z.