{"library":"pyffx","title":"pyffx","description":"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.","language":"python","status":"maintenance","last_verified":"Mon Apr 27","install":{"commands":["pip install pyffx"],"cli":null},"imports":["from pyffx import Integer","from pyffx import String"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"from pyffx import Integer, String\n\n# Key must be 16, 24, or 32 bytes\nkey = b'mysecretkey12345'  # 16 bytes\n\n# Encrypt an integer up to 10^6-1\nfpe_int = Integer(key, radix=10, length=6)\nplaintext_int = 123456\nciphertext_int = fpe_int.encrypt(plaintext_int)\nprint(f'{plaintext_int} -> {ciphertext_int}')\ndecrypted_int = fpe_int.decrypt(ciphertext_int)\nprint(f'{ciphertext_int} -> {decrypted_int}')\n\n# Encrypt a string with custom alphabet\nfpe_str = String(key, alphabet='abcdefghijklmnopqrstuvwxyz', length=10)\nplaintext_str = 'helloworld'\nciphertext_str = fpe_str.encrypt(plaintext_str)\nprint(f'{plaintext_str} -> {ciphertext_str}')\ndecrypted_str = fpe_str.decrypt(ciphertext_str)\nprint(f'{ciphertext_str} -> {decrypted_str}')","lang":"python","description":"Basic usage of Integer and String FPE","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}