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
hmac()
Beispiel
hmac(object message,object key,[string algorithm,[string encoding]]):string
Argumente
Die Argumente für diese Funktion sind fest vorgegeben. Ausser den nachfolgenden Argumenten dürfen keine weiteren verwendet werden.
Name | Typ | Required | Default Value | Beschreibung |
---|---|---|---|---|
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 environment. |