$hmac » History » Version 2
Per Amundsen, 12/31/2018 09:11 AM
| 1 | 1 | Per Amundsen | _Added in 2.3_ |
|---|---|---|---|
| 2 | |||
| 3 | *$hmac(text|&binvar|filename, [key], [hash], [N])* |
||
| 4 | |||
| 5 | Returns an HMAC (keyed-Hash Message Authentication Code) based on the supplied key. |
||
| 6 | |||
| 7 | 2 | Per Amundsen | _See also [[$hotp]], [[$totp]]._ |
| 8 | |||
| 9 | 1 | Per Amundsen | *Parameters* |
| 10 | |||
| 11 | text|&binvar|filename - The text or &binvar or filename to calculate. |
||
| 12 | [key] - The key to hash with. (optional) |
||
| 13 | [hash] - Hash type: md5, sha1 (default), sha256, sha384, or sha512. (optional) |
||
| 14 | [N] - The type to calculate N = 0 for plain text (default), 1 for &binvar, 2 for filename. (optional) |
||
| 15 | |||
| 16 | *Example* |
||
| 17 | |||
| 18 | <pre> |
||
| 19 | ; calculate the sha1 hmac hash for the text 'Hello World' using the key 'test'. |
||
| 20 | //echo -ag The sha1 hmac for Hello World is $hmac(Hello World, test, sha1) |
||
| 21 | </pre> |