> For the complete documentation index, see [llms.txt](https://docs.tonic.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.tonic.ai/app/generation/generators/generator-reference/alphanumeric-string-key.md).

# Alphanumeric String Key

Generates unique alphanumeric strings of the same length as the input.

For example, for the origin value `ABC123`, the output value is a six-character alphanumeric string such as `D24N05`.

You can configure the generator to:

* Preserve a value prefix. For example, if the origin value always starts with `acct_`, you might want to preserve that in the output value, and only mask the unique part of the identifier.
* Preserve a specified number of characters from the end of each source value. For example, you might want the last 3 characters of each destination value to be the same as the last 3 characters of the source value.&#x20;
* Only replace numerical characters, and keep other types of characters as is.

## Characteristics <a href="#alphanumeric-string-key-characteristics" id="alphanumeric-string-key-characteristics"></a>

<table data-header-hidden><thead><tr><th valign="top"></th><th valign="top"></th></tr></thead><tbody><tr><td valign="top"><strong>Consistency</strong></td><td valign="top">Yes, can be made self-consistent.</td></tr><tr><td valign="top"><strong>Linking</strong></td><td valign="top">No, cannot be linked.</td></tr><tr><td valign="top"><strong>Differential privacy</strong></td><td valign="top">No</td></tr><tr><td valign="top"><strong>Data-free</strong></td><td valign="top">No</td></tr><tr><td valign="top"><strong>Allowed for primary keys</strong></td><td valign="top">Yes</td></tr><tr><td valign="top"><strong>Allowed for unique columns</strong></td><td valign="top">Yes</td></tr><tr><td valign="top"><strong>Uses format-preserving encryption (FPE)</strong></td><td valign="top">Yes</td></tr><tr><td valign="top"><strong>Privacy ranking</strong></td><td valign="top"><ul><li>3 if not consistent</li><li>4 if consistent</li></ul></td></tr><tr><td valign="top"><strong>Generator ID (for the API)</strong></td><td valign="top"><a href="/app/api/quick-start-guide/tonic-api-generator-assignment/generator-api-reference/generator-api-ref-alphanumeric-string-key.md"><code>AlphaNumericPkGenerator</code></a></td></tr></tbody></table>

## How to configure <a href="#alphanumeric-string-key-configure" id="alphanumeric-string-key-configure"></a>

To configure the generator:

1. To preserve a prefix value, in the **Preserve prefix** field, type the prefix string to preserve in the output values.\
   \
   For example, if you set **Preserve prefix** to `acct_`, then any source values that start with `acct_` will also start with `acct_` in the destination data.
2. To preserve a set of characters from the end of the original value, in the **Preserve suffix length** field, type the the number of characters to preserve at the end of each value.\
   \
   For example, if you set **Preserve suffix** length to 3, then the destination values all have the same final 3 characters as the source values. For example, for the source value `abc123efg`, the destination value ends with `efg`.
3. To only replace the numerical characters, toggle **Mask digits only** to the on position.
4. Toggle the **Consistency** setting to indicate whether to make the generator self-consistent.\
   \
   By default, the generator is not consistent.
5. If [Structural data encryption](/app/generation/generators-assign-config/generators-data-encryption-config.md) is enabled, then to use it for this column, in the advanced options section, toggle **Use data encryption process** to the on position.


---

# 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.tonic.ai/app/generation/generators/generator-reference/alphanumeric-string-key.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.
