# ComputeHash (Str, Key)

| **Name**    | ***ComputeHash***                                                                                                                            |
| ----------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
| Syntax      | ComputeHash (String str, String key)                                                                                                         |
| Purpose     | To return a hashed representation of a given string using a specified key.                                                                   |
| Description | Returns (A base 64 encoded value) a hashed representation of a given string using a key.                                                     |
| Return Type | String                                                                                                                                       |
| Parameters  | <p>str \[System.String] – The raw string to use as the input</p><p>key \[System.String] – The secret random key used to compute the hash</p> |

![](https://content.gitbook.com/content/zEifS4h8yurLAAwiGNX2/blobs/kg4UdIipUOK5P4JAMCqo/0.png)

**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

{% hint style="info" %}
**Note:** Random keys can be used for generating unique hashes, such as in hash tables.
{% endhint %}

![](https://content.gitbook.com/content/zEifS4h8yurLAAwiGNX2/blobs/g88MLwMQIXF6dbXGefHF/1.png)

Right-click on the function transformation object and select *Preview Output.* You can see that Astera has returned the hashed value of the specified string, using the specified *key* value.

![](https://content.gitbook.com/content/zEifS4h8yurLAAwiGNX2/blobs/qGy8oyxjoEQScKy6HLLK/2.png)
