# 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)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://documentation.astera.com/functions/encoding/computehash-str-key.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
