ComputeHash (Str, Key, hex)
Last updated
Last updated
© Copyright 2023, Astera Software
Name | ComputeHash |
Syntax | ComputeHash (String str, String key, Boolean hex) |
Purpose | To return a hashed representation of a given string using a specified key. |
Description | Returns (A base 64 encoded value or a string representation of the value – If hex value is ‘True’) a hashed representation of a given string using a key. |
Return Type | String |
Parameters | str [System.String] – The raw string to use as the input key [System.String] – The secret random key used to compute the hash hex [System.Boolean] – Used to specify whether the resulting hash should be represented in hexadecimal format (True) or as raw binary data (False) |
Example
In this example, we are passing the required parameters to the function transformation object using a Variables object.
Where,
str = Hello World!
key = 0x95A1F27B384C3B50
Note: Random keys can be used for generating unique hashes, such as in hash tables.
hex = True
Right-click on the function transformation object and select Preview Output. You can see that the tool has returned the hexadecimal hashed value of the specified string, using the specified key value.
Similarly, the following will be the output if the hex value is specified as “False”: