Restructure ChaosCrypt from a single-file script into a complete, installable Python package with three interfaces: a typed Python API, an argument-driven CLI, and a bilingual interactive TUI. The algorithm itself is unchanged. Ciphertexts and key files remain fully interoperable with the original implementation in both directions, which is enforced by dedicated tests rather than merely documented. Added - Library API: ChaosCrypt facade plus ChaosCryptCore for the raw algorithm - Unified error hierarchy: 16 named types, all ChaosCryptError subclasses, rendering as ChaosCrypt_ERR_<Detail>_<Code> - CLI: keygen, encrypt, decrypt, file, info, chpwd, tui, with --json output, stdin/stdout piping, and three password sources per secret - Bilingual TUI: English default, runtime switch to Chinese, getpass password entry with a non-TTY fallback that keeps it scriptable - Binary and file support: encrypt_bytes/decrypt_bytes and encrypt_file/decrypt_file - Key management: change_key_password rewraps without altering key material; export_key_text/load_from_text move a key without touching disk - Documentation: SECURITY.md with the full design and threat analysis, plus docs/ covering the API, CLI, architecture and build process - Test suite: 92 tests across round-trips, binary safety, key management, error types, CLI, TUI, i18n and legacy interoperability - Packaging: pyproject.toml, setup.py compatibility shim, MANIFEST.in, py.typed, examples, MIT licence Fixed - Conflicting --pwd option between the -p and -P groups prevented the CLI from starting at all - Wrong key file password reported as file corruption (E002); structural validation now distinguishes it from a damaged file (E003) - export_key_text produced key material without loading it into the instance - Non-hexadecimal input was accepted as ciphertext and silently decrypted into garbage, making corruption indistinguishable from success; malformed input now raises E010 before any processing - TUI failed under piped input because getpass requires a TTY - TUI kept reading the default key file name after generating a new one Changed - Source tree reorganised: the package lives at chaoscrypt/, with tests, examples and legacy alongside it; documentation and build artefacts at the repository root - Code comments unified in English; public docstrings document parameters, return values and raised exceptions - English is now the default UI language - ChaosCryptChat removed from the repository - Attribution updated to Dvs (DvsXT); project URLs point to Gitea
5.2 KiB
5.2 KiB
Changelog
All notable changes to this project are documented in this file.
The format follows Keep a Changelog, and this project adheres to Semantic Versioning.
2.1.6 — 2026-09-27
Packaging and documentation release. The algorithm is unchanged; this version restructures the project as a distributable library and brings the documentation in line with it.
Added
- Bilingual interactive TUI. A menu-driven interface with English and
Chinese, switchable at runtime. Uses
getpassfor password entry on a terminal and degrades to plain input when piped, so it remains scriptable. - Full command line interface. Subcommands
keygen,encrypt,decrypt,file,info,chpwdandtui, with--jsonoutput, stdin/stdout piping, and three ways to supply each password (inline, environment variable, password file). - Unified error hierarchy. Sixteen named error types, all subclasses of
ChaosCryptError, each rendering asChaosCrypt_ERR_<Detail>_<Code>. Every failure path in the library now raises rather than returning a sentinel. - Binary and file support.
encrypt_bytes/decrypt_bytesfor arbitrary binary data, andencrypt_file/decrypt_filefor whole files. - Key management helpers.
change_key_passwordre-wraps a key file under a new password without altering the key material.export_key_textandload_from_textmove a key without touching disk. - Comprehensive documentation.
SECURITY.mdpresents the design, key space derivation, threat model and attack analysis in full.docs/contains API, CLI and architecture references. - Test suite. Round-trip integrity, binary safety, key management, error types, CLI behaviour, TUI interaction, internationalisation, and bidirectional interoperability with the original implementation.
- Packaging.
pyproject.toml,MANIFEST.in,.gitignore,py.typed, runnable examples, and MIT licensing.
Changed
- Project restructured into a standard library layout. The importable
package now lives at
chaoscrypt/, with tests, examples and the legacy implementation alongside it, and documentation and build artefacts at the repository root. - Code comments unified in English, and public docstrings expanded to document parameters, return values and raised errors.
- English is now the default UI language, with Chinese available as an alternative.
- Packaging metadata updated for the new layout and SPDX licence expression.
Fixed
Six defects found and corrected during the restructure:
- The
-pand-Poption groups both registered--pwd, causing anargparseconflict that prevented the CLI from starting at all. - An incorrect key file password was reported as a corrupted file (
E002) rather than a credential error (E003). A structural validation step now distinguishes the two cases. export_key_textproduced key material without loading it into the instance, so the returned key could not be used directly.- Non-hexadecimal input was accepted as ciphertext and silently decrypted
into garbage. This was the most serious defect: a corrupt or truncated
ciphertext was indistinguishable from a successful decryption. Malformed
input now raises
E010before any processing occurs. - The TUI failed outright under piped input, because
getpassrequires a TTY. It now detects this and falls back to plain input. - After generating a key file, the TUI continued to look at the default file name rather than the one just created. The key file is now remembered for the rest of the session.
Security
- Clearly documented that ChaosCrypt is unaudited and non-standardised, and that it is intended for obfuscation, personal use, and research or teaching rather than production deployment.
- Documented the deterministic-output property and its consequences, and the information disclosed by ciphertext length and Base64 padding class.
- Documented the strength of the construction in full, including the approximately 10^5621 key space, the absence of algebraic and number-theoretic structure, and the effect of Shor's and Grover's algorithms.
Compatibility
Fully backward compatible with the original single-file implementation, in both directions:
- key files produced by either implementation load in the other;
- ciphertext produced by either implementation decrypts in the other;
- the default key file name remains
encryption.key, and the on-disk key file format is unchanged.
2.0.0 — Original release
The original single-file implementation of the ChaosCrypt cipher.
Added
- Random system key generation: independent uppercase and lowercase bijections, digit and padding substitutions, a 10-bit case-flip pattern, a 4096-nibble long key and a 512-nibble short key.
- Password-protected key file wrapping.
- Layered encryption: Base64 encoding, substitution, conditional case flipping, whole-message reversal, and two XOR stages.
- Interactive menu for encryption, decryption and key management.