Project

General

Profile

Added in 2.3

$hmac(text|&binvar|filename, [key], [hash], [N])

Returns an HMAC (keyed-Hash Message Authentication Code) based on the supplied key.

Parameters

text|&binvar|filename - The text or &binvar or filename to calculate.
[key] - The key to hash with. (optional)
[hash] - Hash type: md5, sha1 (default), sha256, sha384, or sha512. (optional)
[N] - The type to calculate N = 0 for plain text (default), 1 for &binvar, 2 for filename. (optional)

Example

; calculate the sha1 hmac hash for the text 'Hello World' using the key 'test'.
//echo -ag The sha1 hmac for Hello World is $hmac(Hello World, test, sha1)

Also available in: PDF HTML TXT