An experimental custom text codec named Codava, built from scratch in Python, featuring a stealth password manager as a practical use-case demonstration.
Unlike standard UTF-8 (where English characters take 1 byte and Russian characters take 2 bytes), Codava is optimized for bilingual text and source code. Every supported character (Cyrillic, Latin, digits, and Python syntax tokens) occupies exactly 1 byte.
To achieve this, each byte (8 bits) is divided into logical bit-flags:
- Bit 1 (MSB): Language flag (
0for Russian,1for English). - Bit 2: Case flag (
0for lowercase,1for UPPERCASE). - Bits 3–8: The exact alphabet position of the character.
Digits, Python syntax (=, :, (, )), and system characters (\n, whitespace) are mapped to a custom compact lookup table special_encoding utilizing free byte spaces without overlapping the alphabet bitmask.
Because the codec uses a unique bitwise layout, any file saved with the codava encoding turns into unreadable garbage text if opened via standard Notepad, VS Code, or a web browser. The file can only be properly parsed and decoded by a script running this specific codec.
- Clone this repository or download
codava.pyandpassword_manager.pyinto the same directory. - Run the demonstration script:
python password_manager.py
- The script will generate an encrypted
password.binfile, write data using thecodavaencoding, and successfully decode it back to the console.
You can easily drop this codec into any of your own Python projects. Simply import the module at the very beginning of your code:
import codava
# One-liner to write encrypted data
codava.save_secret("my_data.bin", "Secret text 123")
# One-liner to read and decrypt data
text = codava.load_secret("my_data.bin")
print(text)