The `ff3` library provides Format Preserving Encryption (FPE) using the NIST FF3 and FF3-1 algorithms. It is currently at version 1.0.3 and receives minor updates for features and compatibility, with the core encryption logic stable since v1.0.0.
pip install ff3Verified import paths — ran on the pinned version, not inferred.
Encrypt and decrypt a numeric string using the default FF3 algorithm with a specified key and tweak.
Ensure your tweak data matches the expected length for FF3 (8 bytes) or FF3-1 (7 bytes). The default `FF3Cipher` constructor uses FF3; use `FF3Cipher.withFF3_1(key, tweak)` for FF3-1.
Verify key and tweak byte lengths before instantiation. For string literals, ensure they are encoded to bytes (e.g., `'your_key_string'.encode('utf-8')`) and then sliced or padded to the exact required length.Persist and reuse the `FF3Cipher` instance or reconstruct it with the identical custom alphabet for decryption operations.
Ensure the `key` byte string is exactly 16, 24, or 32 bytes long. Use `.encode('utf-8')` and slice/pad if starting from a string.Ensure `tweak` is 8 bytes for standard FF3 (default `FF3Cipher` constructor) or 7 bytes for FF3-1 (if using `FF3Cipher.withFF3_1`). Use `.encode('utf-8')` and slice/pad if starting from a string.First, ensure installation with `pip install ff3`. If installed, verify the import statement is exactly `from ff3 import FF3Cipher`.
Ensure `plaintext` and `ciphertext` passed to `encrypt`/`decrypt` are `str` type. Note that `key` and `tweak` *must* be `bytes` type.
No dependency data recorded yet.