# Format-preserving encryption (FPE)

Using format-preserving encryption (FPE) means to encrypt data in such a way that the output is in the same format as the input. For example, a number in the input produces a number in the generated output.

## Generators that use FPE <a href="#generators-fpe-generator-list" id="generators-fpe-generator-list"></a>

For the following generators, Tonic Structural uses FPE to encrypt the generated values. Note that the Structural implementation of FPE might not guarantee compliance with standards. For example, the ASCII Key generator does not guarantee that the length of the output data matches the length of the input data.

* [Alphanumeric String Key](https://docs.tonic.ai/app/generation/generators/generator-reference/alphanumeric-string-key)
* [ASCII Key](https://docs.tonic.ai/app/generation/generators/generator-reference/ascii-key)
* [Finnish Personal Identity Code](https://docs.tonic.ai/app/generation/generators/generator-reference/finnish-personal-identity-code)
* [IBAN ](https://docs.tonic.ai/app/generation/generators/generator-reference/iban)- Only when consistency is enabled or when assigned to a primary key column
* [Integer Key](https://docs.tonic.ai/app/generation/generators/generator-reference/integer-key)
* [MAC Address](https://docs.tonic.ai/app/generation/generators/generator-reference/mac-address)
* [Numeric String Key](https://docs.tonic.ai/app/generation/generators/generator-reference/numeric-string-key)
* [SIN](https://docs.tonic.ai/app/generation/generators/generator-reference/sin)
* [UUID Key](https://docs.tonic.ai/app/generation/generators/generator-reference/uuid-key)

## Addressing encryption errors from FPE <a href="#generators-fpe-encryption-errors" id="generators-fpe-encryption-errors"></a>

Each generator supports a specific input character set or domain.

When a generator attempts to process data that is not within the expected domain, it results in encryption errors. For example, the [Numeric String Key](https://docs.tonic.ai/app/generation/generators/generator-reference/numeric-string-key) generator cannot process a string that includes non-numeric characters such as letters or symbols. The [UUID Key](https://docs.tonic.ai/app/generation/generators/generator-reference/uuid-key) generator cannot process any value that is not a valid UUID.

If you get encryption errors, then it probably means that the column contains values that are incompatible with the selected generator. To address this, you need to choose a different generator.

One option is the [ASCII Key](https://docs.tonic.ai/app/generation/generators/generator-reference/ascii-key) generator, which has very few restrictions on the allowed values.

Another option is to use the [Conditional](https://docs.tonic.ai/app/generation/generators/generator-reference/conditional) generator, which allows you to assign different generators based on column values.
