Table of Contents

HMACHex(algorithm, text, key)

Category: Web function


Description

This function calculates a keyed hexadecimal hash of a given text value using one of the algorithms listed in the table, below.


Arguments

ArgumentTypeDescription
algorithm Text The method to use to generate the hash from text. See the table below.
text Text The message data, combined with the key to generate the final hash value.
keyText The secret key mixed with text to generate the final hash value.

Return value type: Text.


Algorithm Notes
md5
sha1
sha256
sha384
sha512


Remarks

The specified algorithm is used as a Hash-based Message Authentication Code (HMAC). The HMAC process mixes a secret key with the message data, hashes the result with the hash function, mixes that hash value with the secret key again, and then applies the hash function a second time.

Data types other than text are not converted into text automatically. All texts are assumed to have the UTF-8 encoding. The algorithm name is case-insensitive. The key and the value are case-sensitive.


Examples

hmachex('md5', '223jh4gj2h3g4', 'Two lost souls')  //Returns 'fd59298c9f0c5a4b5e617bfefe418f02'


See also