Developer Documentation Library > UNICOM Intelligence Function Library > Miscellaneous functions > Hash
 
Hash
Generate an encoded hash value. This might be required when communicating with web services from an interview script.
Syntax
Hash(<value>, [<algorithm>], [<hex_encoding>]) As String
Parameters
<value>
Type: String
The text to be encoded.
<algorithm>
Type: String
(Optional.) The hashing algorithm to use: SHA256 or SHA512.
<hex_encoding>
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 = Hash ("/projects/end?rst=2&psid=aYA3xQ6gory1u7hdS5o9AQ**&_k=2000", , True)
Debug.Log("SHA256 Hex encoded: " + Result)

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

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

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