> For the complete documentation index, see [llms.txt](https://docs.jentis.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.jentis.com/developer-guide/variables/server-side-variables/public-function-scope/getmd5.md).

# getMD5

## `getMD5` Function

The `getMD5` function generates an **MD5 hash** from a given input string using Node.js’ built-in [`crypto`](https://nodejs.org/api/crypto.html#cryptocreatehashalgorithm-options) module. It supports configurable **output encodings** for flexible use in tracking and transformation scenarios.

***

### Purpose

Use `this.getMD5` to:

* Create a **non-secure hash** of a string (e.g., for deduplication, consistent keys)
* Generate lightweight identifiers or short checksums
* Obfuscate simple input values for non-critical use cases

> ⚠️ **Note:** MD5 is considered insecure for cryptographic purposes. Do **not** use it for hashing sensitive or security-critical data.

***

### Function Definition

| Property          | Description                  |
| ----------------- | ---------------------------- |
| **Function Name** | `this.getMD5`                |
| **Type**          | `function`                   |
| **Available In**  | Server-Side Variables        |
| **Returns**       | `string` (the hashed output) |

***

### Parameters

| Parameter  | Description                                            | Type     | Required                                      | Example    |
| ---------- | ------------------------------------------------------ | -------- | --------------------------------------------- | ---------- |
| `input`    | The string value to hash                               | `string` | <i class="fa-square-check">:square-check:</i> | `"secret"` |
| `encoding` | The output encoding format (`"hex"`, `"base64"`, etc.) | `string` | <i class="fa-square-check">:square-check:</i> | `"hex"`    |

***

### Supported Encodings

Refer to the [Node.js crypto documentation](https://nodejs.org/api/crypto.html#cryptocreatehashalgorithm-options) for supported encodings. Common options:

* `hex` (recommended for readable output)
* `base64`
* `latin1`

***

### Example Usage

```js
async function() {
    let x = this.getMD5("secret", "hex");
    return x;
}
```

This example returns the MD5 hash of the string `"secret"` encoded as a hexadecimal string.

***

### Use Cases

* Generate **consistent hash keys** for non-sensitive data
* Shorten string representations for logging or external IDs
* Create anonymized values when security is **not** a concern

***

### Notes

* Always specify a valid encoding (no default is assumed).
* For secure hashing (e.g., SHA-256), use `this.getHash` instead.
* Output is deterministic: same input and encoding will always return the same result.

***

### Summary

`this.getMD5` is a quick and easy way to generate an MD5 hash in JENTIS server-side variables. While not suitable for cryptographic use, it is useful for creating lightweight, repeatable hashes for general-purpose tracking logic.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.jentis.com/developer-guide/variables/server-side-variables/public-function-scope/getmd5.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
