Skip to main content
Version: Next

HMAC

Generate

const hmac = Cryptopp.HMAC.generate(str, key, 'AES', 'hex');

Parameters

ParameterTypeRequiredDefault
datastring
ArrayBuffer
keystring
ArrayBuffer
hashName of any supported hash
encodeTo"hex"
"base64"
"base64url"
"hex"

Returns: Based on data input type: ArrayBuffer or string

Verify

const hmac_verify = Cryptopp.HMAC.verify(str, key, 'AES', hmac, 'hex');

Parameters

ParameterTypeRequiredDefault
datastring
ArrayBuffer
keystring
ArrayBuffer
hashName of any supported hash
macstring
ArrayBuffer
macStringEncoding"hex"
"base64"
"base64url"
"hex"

Returns: boolean