Creates Hash-based Message Authentication Code for the given string based on the algorithm and encoding.
Hash-based Message Authentication Code (HMAC) is used to verify the data integrity and authenticity of a messagetransmitted.
It involves a cryptographic hash function in combination with a secret key.
The cryptographic hashfunction can be Message Digest 5 (MD5), Secure Hash Algorithm (SHA), and so on
Lucee Function Reference
Function HMAC
Example
hmac(object message,object key,[string algorithm,[string encoding]]):string
Arguments
The arguments for this function are set. You can not use other arguments except the following ones.
Name | Type | Required | Default Value | Description |
---|---|---|---|---|
message | object | Yes | The message to transmit. The message can be a String or a byte array. | |
key | object | Yes | The secret key to create HMAC. The key can be a String or a byte array. | |
algorithm | string | No | HmacMD5 | the algorithm used, default is "HmacMD5" |
encoding | string | No | the encoding used, default encoding is the web charset of the enviroment. |