AES-FPE-FF1
NIST's FF1 mode: encrypts digits or characters into ciphertext of the same format
About AES-FPE-FF1
AES-FPE-FF1 is a block cipher mode of operation from the AES-FF1 format-preserving encryption family. It uses a 16–32-byte key, a 0–1,024-byte nonce and a 16-byte (128-bit) block. It takes the parameter radix (default 10). Its registry entry cites NIST SP 800-38G. It is also known as ff1. NextSSL lists it in the standard tier and exposes it through the safe API.
Overview
Format-preserving encryption (FPE) encrypts data so that the ciphertext has the same format as the plaintext, for example a 16-digit card number to another 16-digit number. FF1, defined in NIST SP 800-38G, is the approved FPE method using AES.
FF1 treats the input as a string of numerals in a chosen radix, such as 10 for decimal digits. It splits the string into two halves and runs a ten-round Feistel network in which each round function computes an AES-CBC-MAC-like PRF over the tweak, the round number and one half, converts the result to a number, and adds it modulo radix^m to the other half. A tweak allows the same key to encrypt different fields independently.
FF1 is based on the FFX scheme by Mihir Bellare, Phillip Rogaway and Terence Spies. NextSSL includes AES-FF1. The related FF3 mode was found to be insecure and FF3-1 has been revised; FF1 remains approved. Callers choose the radix and length. Each field type should use its own tweak, and the domain should be as large as the data allows.
History
2010–2019FFX format-preserving encryption proposed to NIST
FF1 and FF3 published in NIST SP 800-38G
FF3-1 revision drafted after attacks on FF3
Security notes
FF1 is secure only when the domain is large enough; attacks exploit small domains such as short PINs, and NIST has tightened minimum domain-size requirements. FPE is deterministic for a given tweak and provides no integrity.
Typical uses
Sizes
| Field | Bytes | Meaning |
|---|---|---|
| key | 16 – 32 | Secret key |
| nonce | 0 – 1,024 | Nonce / IV |
| block | 16 | Block |
Parameters
| Name | Type | Range | Default | Required |
|---|---|---|---|---|
| radix | u64 | 2 – 256 | 10 | no |
Parameters are passed as a string, for example nextssl_mac("hmac", "hash=sha512", …). Omitted parameters take their declared default.
Use it
from nextssl_demo import NextSSL
ns = NextSSL() # safe API: safe and standard tiers
ct = ns.call("blockmode_encrypt", "aes-fpe-ff1", None, key, iv, data)[0]
pt = ns.call("blockmode_decrypt", "aes-fpe-ff1", None, key, iv, ct)[0]
nextssl_blockmode_encrypt("aes-fpe-ff1", NULL, key, iv, data, out);
use nextssl_core::Params;
use nextssl_registry::{self as reg, Policy};
let alg = reg::new_blockmode_in(reg::all(), Policy::Safe, "aes-fpe-ff1", &Params::new())?;
let ct = alg.encrypt(&key, &iv, &data)?;
Calls follow the NextSSL C ABI and its language bindings. Buffer sizes are validated against the sizes above.
More block cipher modes
All 20Frequently asked questions
What is AES-FPE-FF1?
AES-FPE-FF1 is a block mode in the AES-FF1 format-preserving encryption family. Format-preserving encryption (FPE) encrypts data so that the ciphertext has the same format as the plaintext, for example a 16-digit card number to another 16-digit number. It is also known as ff1.
What are the AES-FPE-FF1 sizes?
In NextSSL, AES-FPE-FF1 uses: key 16 to 32 bytes, nonce 0 to 1,024 bytes, block 16 bytes.
Who designed AES-FPE-FF1 and when?
AES-FPE-FF1 belongs to the AES-FF1 format-preserving encryption family, first published in 2010 by Mihir Bellare, Phillip Rogaway, Terence Spies. Its origin: NIST SP 800-38G.
Which standards define AES-FPE-FF1?
AES-FPE-FF1 is referenced by NIST SP 800-38G.
Is AES-FPE-FF1 safe to use?
AES-FPE-FF1 is in the standard tier. Standardised and sound. Reachable from the safe API. It can be called from the safe API.