$ show dhondta/python-codext
CodExt is a Python library and command-line tool that extends the standard library's codecs with over 120 custom encodings for data transformation. It provides encoding/decoding functionalities across domains including base encodings (baseN, base45, base85, etc.), cryptography (Vigenère, RSA, XOR), compression (gzip, LZ77/LZ78), steganography, and language-based transformations (Leetspeak, Morse, Braille). The system features a heuristic-based guess mode for automated multi-layered decoding and a macro system for chaining codecs. Architected as a plugin-based library, it allows dynamic registration of new codecs and is designed for CTF, security, and data obfuscation tasks. The codebase demonstrates strong modularity with clear separation of concerns between core functionality, codec implementations, and utility modules.
The LLM identified 3 files worth highlighting for reuse:
Implements dynamic codec registration via add() and add_map() functions, allowing new codecs to be added without modifying core. Includes a macro system for defining and loading encoding chains from JSON, enabling reusable transformation pipelines. The plugin architecture is isolated and could be extracted for other extension systems.
Provides a base() factory function that generates encode/decode functions for arbitrary base-N encodings given an alphabet. This pattern eliminates boilerplate for creating base codecs (used for base64, base32, base45, etc.) and is highly reusable for custom base conversion tasks in other projects.
Implements a guessing algorithm using BFS to explore codec chains and scores results with entropy, printable character rate, expansion factor, and optional language detection. This automated decoding approach for multi-layered encoding is a self-contained, reusable pattern applicable to any transformation chain guessing problem.