v2.1.6: Restructure as a distributable library
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
This commit is contained in:
+116
@@ -0,0 +1,116 @@
|
||||
[build-system]
|
||||
requires = ["setuptools>=77", "wheel"]
|
||||
build-backend = "setuptools.build_meta"
|
||||
|
||||
[project]
|
||||
name = "chaoscrypt"
|
||||
version = "2.1.6"
|
||||
description = "A chaos-based obfuscation cipher with a bilingual TUI, a full CLI and a clean Python API."
|
||||
readme = "README.md"
|
||||
requires-python = ">=3.8"
|
||||
license = "MIT"
|
||||
license-files = ["LICENSE"]
|
||||
authors = [
|
||||
{ name = "Dvs (DvsXT)", email = "dvs6666@163.com" },
|
||||
]
|
||||
maintainers = [
|
||||
{ name = "Dvs (DvsXT)", email = "dvs6666@163.com" },
|
||||
]
|
||||
keywords = [
|
||||
"encryption",
|
||||
"cipher",
|
||||
"obfuscation",
|
||||
"chaos",
|
||||
"xor",
|
||||
"keystream",
|
||||
"tui",
|
||||
"cli",
|
||||
"education",
|
||||
]
|
||||
classifiers = [
|
||||
"Development Status :: 5 - Production/Stable",
|
||||
"Environment :: Console",
|
||||
"Intended Audience :: Developers",
|
||||
"Intended Audience :: Education",
|
||||
"Intended Audience :: End Users/Desktop",
|
||||
"Natural Language :: Chinese (Simplified)",
|
||||
"Natural Language :: English",
|
||||
"Operating System :: OS Independent",
|
||||
"Programming Language :: Python :: 3",
|
||||
"Programming Language :: Python :: 3 :: Only",
|
||||
"Programming Language :: Python :: 3.8",
|
||||
"Programming Language :: Python :: 3.9",
|
||||
"Programming Language :: Python :: 3.10",
|
||||
"Programming Language :: Python :: 3.11",
|
||||
"Programming Language :: Python :: 3.12",
|
||||
"Programming Language :: Python :: 3.13",
|
||||
"Topic :: Education",
|
||||
"Topic :: Security :: Cryptography",
|
||||
"Topic :: Utilities",
|
||||
]
|
||||
|
||||
# No third-party runtime dependencies: works immediately after `pip install`.
|
||||
dependencies = []
|
||||
|
||||
[project.optional-dependencies]
|
||||
dev = [
|
||||
"build>=1.0",
|
||||
"twine>=4.0",
|
||||
"pytest>=7.0",
|
||||
"pytest-cov>=4.0",
|
||||
]
|
||||
|
||||
[project.urls]
|
||||
Homepage = "https://git.dvscloud.net/dvs/ChaosCrypt"
|
||||
Documentation = "https://git.dvscloud.net/dvs/ChaosCrypt/src/branch/main/docs"
|
||||
Source = "https://git.dvscloud.net/dvs/ChaosCrypt"
|
||||
Changelog = "https://git.dvscloud.net/dvs/ChaosCrypt/src/branch/main/CHANGELOG.md"
|
||||
"Security Policy" = "https://git.dvscloud.net/dvs/ChaosCrypt/src/branch/main/SECURITY.md"
|
||||
"Issue Tracker" = "https://git.dvscloud.net/dvs/ChaosCrypt/issues"
|
||||
|
||||
[project.scripts]
|
||||
chaoscrypt = "chaoscrypt.cli:cli_main"
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Layout
|
||||
# ---------------------------------------------------------------------------
|
||||
# ChaosCrypt/ repository root: docs and build artefacts
|
||||
# ├── README.md SECURITY.md LICENSE CHANGELOG.md
|
||||
# ├── docs/
|
||||
# ├── pyproject.toml
|
||||
# ├── dist/
|
||||
# └── chaoscrypt/ source tree
|
||||
# ├── __init__.py the importable package
|
||||
# ├── _core.py cli.py tui.py errors.py i18n.py
|
||||
# ├── tests/
|
||||
# ├── examples/
|
||||
# └── legacy/
|
||||
#
|
||||
# The package sits alongside tests/, examples/ and legacy/ in the same
|
||||
# directory, so the distribution contents are stated explicitly. Automatic
|
||||
# discovery would treat those directories as namespace packages and ship them
|
||||
# in the wheel.
|
||||
# ---------------------------------------------------------------------------
|
||||
[tool.setuptools]
|
||||
py-modules = []
|
||||
packages = ["chaoscrypt"]
|
||||
|
||||
[tool.setuptools.package-data]
|
||||
chaoscrypt = ["py.typed"]
|
||||
|
||||
[tool.pytest.ini_options]
|
||||
testpaths = ["chaoscrypt/tests"]
|
||||
addopts = "-q"
|
||||
filterwarnings = [
|
||||
"error::DeprecationWarning:chaoscrypt.*",
|
||||
]
|
||||
|
||||
[tool.coverage.run]
|
||||
source = ["chaoscrypt"]
|
||||
|
||||
[tool.coverage.report]
|
||||
exclude_lines = [
|
||||
"pragma: no cover",
|
||||
"if TYPE_CHECKING:",
|
||||
"if __name__ == .__main__.:",
|
||||
]
|
||||
Reference in New Issue
Block a user