$hmac » History » Version 3
Per Amundsen, 02/23/2023 01:42 PM
| 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 | 3 | Per Amundsen | table(ktable). |
| 12 | |*Parameter*|*Description*| |
||
| 13 | | text<notextile>|</notextile>&binvar<notextile>|</notextile>filename | The text or &binvar or filename to calculate. | |
||
| 14 | | [key] | The key to hash with. (optional) | |
||
| 15 | | [hash] | Hash type: md5, sha1 (default), sha256, sha384, or sha512. (optional) | |
||
| 16 | | [N] | The type to calculate N = 0 for plain text (default), 1 for &binvar, 2 for filename. (optional) | |
||
| 17 | 1 | Per Amundsen | |
| 18 | *Example* |
||
| 19 | |||
| 20 | <pre> |
||
| 21 | ; calculate the sha1 hmac hash for the text 'Hello World' using the key 'test'. |
||
| 22 | //echo -ag The sha1 hmac for Hello World is $hmac(Hello World, test, sha1) |
||
| 23 | </pre> |