---
title: "Action create_hash"
description: "Creates a cryptographic hash from a constant value and a secret key."
---

# Action `create_hash`

> **System ID:** `action_create_hash`

## Description

Takes a value from a constant, appends a secret key (salt), and computes a hash. Saves the result to another constant. Used for tokens, verification codes, and protected identifiers.

## Events (scenario branches)

| Event | When it occurs |
|-------|----------------|
| **success** | Hash generated and saved to a constant |
| **error** | No value in the constant or `secret_key` not set |

## Parameters

| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| `key_in_const` | string | no | `"idcustomer"` | Name of the constant with the value to hash |
| `secret_key` | string | yes | — | Secret key (salt) appended to the value |
| `algorithm` | string | no | `"sha1"` | Algorithm: `sha1`, `sha256`, `md5`, etc. |
| `digest` | string | no | `"base64"` | Output format: `base64`, `hex`, `binary` |
| `set_to` | string | no | `"generated_hash"` | Constant for saving the result |

## Configuration example

```json
{
  "key_in_const": "user_id",
  "secret_key": "my_secret_key_123",
  "algorithm": "sha256",
  "digest": "hex",
  "set_to": "auth_token"
}
```

## Related docs

- [Actions reference](/en/actionjail/reference/actions-reference.md)
