$hmac

From Scriptwiki
Jump to: navigation, search

Returns HMAC hash value for the specified data using the given key, where hash can be md5, sha1 (default), sha256, sha384 or sha512 and N = 0 for plain text (default), 1 for &binvar, 2 for filename.

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

Example

$hmac(text string, hmackey, sha256)

Returns the HMAC-SHA-256 hash value of text string with key hmackey (19df3338494ee69e5a1648f9456677355878af1ffed0f74a6fc0effee8551089)

//bset -t &bvar 1 text string | echo -ag $hmac(&bvar,hmackey,sha256,1)

Echoes the same as the last value, this time using a binary variable.

$hmac(mirc.ini,hmackey,sha1,2)

Returns the HMAC-SHA-1 hash value of the file mirc.ini.

See Also