Developer Documentation Library > Scripting > UNICOM Intelligence Function Library > Miscellaneous functions > HashHMAC
 
HashHMAC
Generate an encoded keyed hash value by using the HMAC method. This might be useful to verify the integrity and authenticity of a message or data when communicating with web services from an interview script.
Syntax
HashHMAC(Value, [Key], [Algorithm], [HexEncoding]) As String
Parameters
Value
Type: String
The text to be encoded.
Key
Type: String
The shared secret key used for generating the HMAC variant of the value.
Algorithm
Type: String
Optional. The hashing algorithm to use: SHA256 or SHA512.
HexEncoding
Type: Boolean
Optional. True generates a hex-encoded character string. False generates a Base64‑encoded character string. The default value is False.
(return)
Type: String
Returns the encoded hash string.
Example
Dim Result
Result = HashHMAC("/projects/end?rst=2&psid=aYA3xQ6gory1u7hdS5o9AQ**&_k=2000", "28395fc5d93474aa4f53ba2d0a6c07e276074ed", , True)
Debug.Log("SHA256 HMAC Hex encoded: " + Result)

Result = HashHMAC("/projects/end?rst=2&psid=aYA3xQ6gory1u7hdS5o9AQ**&_k=2000", "28395fc5d93474aa4f53ba2d0a6c07e276074ed")
Debug.Log("SHA256 HMAC Base64 encoded: " + Result)

Result = HashHMAC("/projects/end?rst=2&psid=aYA3xQ6gory1u7hdS5o9AQ**&_k=2000", "28395fc5d93474aa4f53ba2d0a6c07e276074ed", "SHA512" , True)
Debug.Log("SHA512 HMAC Hex encoded: " + Result)

Result = HashHMAC("/projects/end?rst=2&psid=aYA3xQ6gory1u7hdS5o9AQ**&_k=2000", "28395fc5d93474aa4f53ba2d0a6c07e276074ed","SHA512")
Debug.Log("SHA512 HMAC Base64 encoded: " + Result)
See also
Hash
Miscellaneous functions