# Generate TOTP

The Time-based One-Time Password algorithm (TOTP) is an algorithm that computes a one-time password from a shared secret key and the current time. It has been adopted as Internet Engineering Task Force standard RFC 6238, is the cornerstone of Initiative For Open Authentication (OAUTH), and is used in a number of two-factor authentication systems. A TOTP is an HOTP where the counter is the current time. Enter the secret as the input or leave it blank for a random secret to be generated. T0 and T1 are in seconds. Generate TOTP lives in the **Cryptography** category of the `fx` menu. See [TOTP](https://datatracker.ietf.org/doc/html/rfc6238) 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`.                            |
| Epoch offset (T0) | number | no       | `0`     | Numeric value. Default `0`.                            |
| Interval (T1)     | number | no       | `30`    | Numeric value. Default `30`.                           |

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

## Returned value

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

## Limitations

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

## Example

<details>
<summary>Run Generate TOTP</summary>

The Time-based One-Time Password algorithm (TOTP) is an algorithm that computes a one-time password from a shared secret key and the current time. 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**, **Epoch offset (T0)**, **Interval (T1)** and keep defaults unless your format requires otherwise.

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

</details>
