Pure-Python, zero-dependency speed-up across every hot path. No public API,
error-semantics or security change.
Measured (interleaved A/B min-of-N, idle 16-core, 1 KiB payload):
Base64 decode 21.98x
Base58 encode 8.01x
ChaCha20-Poly1305 3.54x
XChaCha20-Poly1305 3.28x
Base64 encode 2.98x
AES-256-GCM (enc) 2.25x (dec) 2.26x
AES-GCM-SIV enc 2.06x
AES-256 CTR/ECB/CBC 2.01x / 1.96x / 1.88x
AES single block 1.87x
Poly1305 MAC 1.41x
Ed25519 sign 1.41x
X25519 base 1.19x
BLAKE2b / SHA3-512 / SHAKE128 1.34x / 1.33x / 1.30x
=> 24 improved, 3 unchanged, 0 regressed.
Techniques (all pure Python):
- code-generated, fully unrolled AES round function and Keccak-f[1600]
- big-integer bulk operations for GHASH, POLYVAL, buffer XOR, Base64 pack
- precomputed lookup tables (AES T-tables, GHASH/POLYVAL 4-bit windows)
- branch-free constant-time selection in Ed25519 scan and X25519 ladder
- lazy modular reduction in X25519 field arithmetic
- batched Base58/Base64 processing
- inlined inner loops in AEAD assembly and the SHA-2 message schedule
Verification:
- full test suite: 639 passed, 1 skipped, 0 failed
- all FIPS / RFC / NIST vectors reproduce byte-for-byte
- differential probe of 1266 deterministic inputs: identical
(one unreachable private-helper edge case, no caller can reach it)
- public API signature comparison: 0 removals, 0 changes
- independent security regression suite: 35 / 35
Also adds docs/benchmark.md, bench/benchmark.py and the v3.2.1 documentation.
87 lines
3.1 KiB
TOML
87 lines
3.1 KiB
TOML
[build-system]
|
|
requires = ["setuptools>=61.0", "wheel"]
|
|
build-backend = "setuptools.build_meta"
|
|
|
|
[project]
|
|
name = "purepycrypto"
|
|
version = "3.2.1"
|
|
description = "Pure-Python cryptography library (zero dependencies): SHA-2/SHA-3/BLAKE2b, AES-GCM(-SIV), ChaCha20-Poly1305, X25519/Ed25519, RSA-OAEP/PSS, with built-in TUI and command-line tool"
|
|
readme = "README.md"
|
|
requires-python = ">=3.7"
|
|
license = { text = "MIT" }
|
|
authors = [
|
|
{ name = "Dvs(DvsXT)", email = "dvs6666@163.com" },
|
|
]
|
|
keywords = [
|
|
"cryptography", "crypto", "pure-python", "aes", "aes-gcm", "aes-gcm-siv",
|
|
"chacha20", "poly1305", "x25519", "ed25519", "rsa", "oaep", "pss",
|
|
"sha256", "sha512", "sha3", "keccak", "shake", "blake2b",
|
|
"argon2", "scrypt", "hkdf", "pbkdf2", "hmac", "cli", "tui",
|
|
]
|
|
classifiers = [
|
|
"Development Status :: 5 - Production/Stable",
|
|
"Intended Audience :: Developers",
|
|
"License :: OSI Approved :: MIT License",
|
|
"Operating System :: OS Independent",
|
|
"Environment :: Console",
|
|
"Programming Language :: Python :: 3",
|
|
"Programming Language :: Python :: 3.7",
|
|
"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 :: Security :: Cryptography",
|
|
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
]
|
|
dependencies = []
|
|
|
|
[project.optional-dependencies]
|
|
test = ["pytest>=7.0"]
|
|
dev = ["pytest>=7.0", "build", "twine"]
|
|
# Cross-verification / comparison (optional; test-only, not a runtime dependency)
|
|
compare = ["pycryptodome", "cryptography>=45"]
|
|
|
|
[project.urls]
|
|
Homepage = "https://git.dvscloud.net/dvs/purepycrypto"
|
|
Documentation = "https://git.dvscloud.net/dvs/purepycrypto#documentation"
|
|
Source = "https://git.dvscloud.net/dvs/purepycrypto"
|
|
|
|
[project.scripts]
|
|
# ----------------------------------------------------------------------
|
|
# Executable command (installed into Python's Scripts directory)
|
|
# ----------------------------------------------------------------------
|
|
# Register only ONE command, `purepycrypto`, targeting `purepycrypto:main`:
|
|
# * no arguments -> launch the interactive TUI
|
|
# * with arguments -> command-line mode (hash/aes/rsa/x25519/kdf/...)
|
|
#
|
|
# After installation it can be used directly:
|
|
# purepycrypto # TUI
|
|
# purepycrypto hash --text abc --hex # command line
|
|
# purepycrypto --help # help
|
|
#
|
|
# As a library: import purepycrypto
|
|
# Without installation, the equivalent is: python -m purepycrypto [subcommand]
|
|
purepycrypto = "purepycrypto:main"
|
|
|
|
[tool.setuptools]
|
|
packages = [
|
|
"purepycrypto",
|
|
"purepycrypto.tests",
|
|
"purepycrypto.examples",
|
|
"purepycrypto.scripts",
|
|
"purepycrypto.single",
|
|
]
|
|
|
|
[tool.setuptools.package-data]
|
|
"purepycrypto" = ["py.typed"]
|
|
"purepycrypto.tests" = ["vectors/*.json"]
|
|
# Single-file bundle (if generated)
|
|
"purepycrypto.single" = ["*.py"]
|
|
|
|
[tool.pytest.ini_options]
|
|
testpaths = ["purepycrypto/tests"]
|
|
python_files = ["test_*.py"]
|
|
addopts = "-v --tb=short"
|