Skip to main content
Version: 0.3.0

CMAC

Generate

const cmac = Cryptopp.CMAC.generate(str, key, 'AES', 'hex');

Parameters

ParameterTypeRequiredDefault
datastring
ArrayBuffer
keystring
ArrayBuffer
cipherName of any supported block cipher
encodeTo"hex"
"base64"
"base64url"
"hex"

Returns: Based on data input type: ArrayBuffer or string

Verify

const cmac_verify = Cryptopp.CMAC.verify(str, key, 'AES', cmac, 'hex');

Parameters

ParameterTypeRequiredDefault
datastring
ArrayBuffer
keystring
ArrayBuffer
cipherName of any supported block cipher
macstring
ArrayBuffer
macStringEncoding"hex"
"base64"
"base64url"
"hex"

Returns: boolean