# Generate HOTP

The HMAC-based One-Time Password algorithm (HOTP) is an algorithm that computes a one-time password from a shared secret key and an incrementing counter. It has been adopted as Internet Engineering Task Force standard RFC 4226, is the cornerstone of Initiative For Open Authentication (OAUTH), and is used in a number of two-factor authentication systems. Enter the secret as the input or leave it blank for a random secret to be generated. Generate HOTP lives in the **Others** category of the `fx` menu. See [HOTP](https://datatracker.ietf.org/doc/html/rfc4226) for format details.

## Parameters

| Parameter   | Type   | Required | Default | Description                                            |
| ----------- | ------ | -------- | ------- | ------------------------------------------------------ |
| Input       | string | yes      | —       | Value to transform. Previous step output or a literal. |
| Name        | string | no       | —       | Argument value for this operation.                     |
| Key size    | number | no       | `32`    | Numeric value. Default `32`.                           |
| Code length | number | no       | `6`     | Numeric value. Default `6`.                            |
| Counter     | number | no       | `0`     | Numeric value. Default `0`.                            |

`Input` is the primary value (previous step output or a literal).

## Returned value

| Type     | Description                                 |
| -------- | ------------------------------------------- |
| `string` | Result of the Generate HOTP transformation. |

## Limitations

- This operation treats Input as raw bytes (binary-capable). Non-text payloads may display differently after decoding.

## Example

<details>
<summary>Run Generate HOTP</summary>

The HMAC-based One-Time Password algorithm (HOTP) is an algorithm that computes a one-time password from a shared secret key and an incrementing counter. Adjust optional parameters when the defaults do not match your payload.

1. Set **Input** to the value to transform (previous step output or a literal).

2. Review **Name**, **Key size**, **Code length**, **Counter** and keep defaults unless your format requires otherwise.

3. Confirm **Output value** shows the transformed result.

</details>
