Hmac$

Takes two parameters, Source, OptionsAndSecret

Description:

Returns a HMAC (signed message digest) of the given source value and secret.

The following standard algorithms are supported and may be specified at the start of the OptionsAndSecret parameter:

If none of the above algorithms are specified, SHA256 is used.

A second optional space-separated value in the OptionsAndSecret parameter of Hex may be specified to output a hexadecimal string instead of Base64.

Example:

[New] HData     =   "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"
[New] HSecret   =   "SecretValue"
[New] Output

Output            =    Hmac$ HData, ("MD5 Hex" && HSecret)
HtmlAlert            ("Hmac$ MD5 in Hex = " & Output)
Output            =    Hmac$ HData, ("MD5" && HSecret)
HtmlAlert            ("Hmac$ MD5 in B64 = " & Output)

Output            =    Hmac$ HData, ("SHA1 Hex" && HSecret)
HtmlAlert            ("Hmac$ SHA1 in Hex = " & Output)
Output            =    Hmac$ HData, ("SHA1" && HSecret)
HtmlAlert            ("Hmac$ SHA1 in B64 = " & Output)

Output            =    Hmac$ HData, ("Hex" && HSecret)
HtmlAlert            ("Hmac$ SHA256 in Hex = " & Output)
Output            =    Hmac$ HData, HSecret
HtmlAlert            ("Hmac$ SHA256 in B64 = " & Output)

Output            =    Hmac$ HData, ("SHA384 Hex" && HSecret)
HtmlAlert            ("Hmac$ SHA384 in Hex = " & Output)
Output            =    Hmac$ HData, ("SHA384" && HSecret)
HtmlAlert            ("Hmac$ SHA384 in B64 = " & Output)

Output            =    Hmac$ HData, ("SHA512 Hex" && HSecret)
HtmlAlert            ("Hmac$ SHA512 in Hex = " & Output)
Output            =    Hmac$ HData, ("SHA512" && HSecret)
HtmlAlert            ("Hmac$ SHA512 in B64 = " & Output)