HMAC
Generate
const hmac = Cryptopp.HMAC.generate(str, key, 'AES', 'hex');
Parameters
Parameter | Type | Required | Default |
---|---|---|---|
data | string ArrayBuffer | ✅ | |
key | string ArrayBuffer | ✅ | |
hash | Name 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
Parameter | Type | Required | Default |
---|---|---|---|
data | string ArrayBuffer | ✅ | |
key | string ArrayBuffer | ✅ | |
hash | Name of any supported hash | ✅ | |
mac | string ArrayBuffer | ✅ | |
macStringEncoding | "hex" "base64" "base64url" | ❌ | "hex" |