Registry / auth-security / pyffx
library0.3.0pypypi✓ verified 87d ago

Pure Python implementation of Format Preserving Encryption (FPE) using the FF1 algorithm from NIST SP 800-38G. Supports integer and string alphabets. Current version 0.3.0, no recent releases.

pip install pyffx
INSTALL
IMPORT
SIG · PYFFX
P
pyffx
auth-securitypythonv0.3.0
Install
2.4s avg
Import
19ms
Disk
17MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.3.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.020s · 19.3MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 2.4s · import 0.018s · 20MB
17MB installed
● package 17MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Integer
from pyffx import Integer
String
from pyffx import String

Basic usage of Integer and String FPE

from pyffx import Integer, String # Key must be 16, 24, or 32 bytes key = b'mysecretkey12345' # 16 bytes # Encrypt an integer up to 10^6-1 fpe_int = Integer(key, radix=10, length=6) plaintext_int = 123456 ciphertext_int = fpe_int.encrypt(plaintext_int) print(f'{plaintext_int} -> {ciphertext_int}') decrypted_int = fpe_int.decrypt(ciphertext_int) print(f'{ciphertext_int} -> {decrypted_int}') # Encrypt a string with custom alphabet fpe_str = String(key, alphabet='abcdefghijklmnopqrstuvwxyz', length=10) plaintext_str = 'helloworld' ciphertext_str = fpe_str.encrypt(plaintext_str) print(f'{plaintext_str} -> {ciphertext_str}') decrypted_str = fpe_str.decrypt(ciphertext_str) print(f'{ciphertext_str} -> {decrypted_str}')
Debug
Known issues
gotchaKey must be exactly 16, 24, or 32 bytes (AES key length). If your key is a string, encode to bytes first.
fix
Ensure key is bytes and length is 16, 24, or 32.
affects: all
gotchaInteger encrypt/decrypt expect a plain integer, not a string. Passing a string will raise TypeError.
fix
Cast to int: fpe_int.encrypt(int('123456'))
affects: all
gotchaString alphabet must contain only unique characters. Duplicates cause incorrect encryption.
fix
Use alphabet with unique characters, e.g., '0123456789'.
affects: all
deprecatedLibrary is unmaintained since 2014. No active development; may not be suitable for production without review.
fix
Consider using alternatives like 'pycryptodome' or 'mbi-omapi' for FPE.
affects: 0.3.0
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'pyffx'
Library not installed or installed in wrong environment.
fix
pip install pyffx
ValueError: The key must be either 16, 24, or 32 bytes
Key length incorrect.
fix
Generate a key of exactly 16, 24, or 32 bytes: key = b'0123456789abcdef'
ValueError: alphabet must contain exactly 'length' characters
Alphabet length mismatch when using custom length.
fix
Ensure alphabet length is >= the length parameter. For Integer, radix is fixed.
TypeError: int() argument must be a string, a bytes-like object or a number, not 'list'
Passed a list instead of integer to Integer.encrypt.
fix
Pass an integer: fpe_int.encrypt(12345)
Upgrade
Version history
0.3.0latest on PyPI · released May 12, 2019
Audit
Dependencies

No dependency data recorded yet.

Agent activity
10 hits · last 30 days
node
8
OpenAI (training)
1
Resources
pyffx — pip install pyffx · libregistry