Release v3.2.1: performance overhaul (1.96x geometric-mean speed-up)
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.
This commit is contained in:
@@ -9,7 +9,41 @@
|
||||
> **Pure Python Cryptography Toolkit — a zero-dependency pure-Python cryptography library.**
|
||||
> SHA-2 / SHA-3 / SHAKE / BLAKE2b · PBKDF2 / HKDF / scrypt / Argon2id · AES (ECB/CBC/CTR/CFB/OFB/GCM) · AES-GCM-SIV · ChaCha20-Poly1305 / XChaCha20-Poly1305 · X25519 · Ed25519 · RSA-OAEP / PSS · PKCS#1 / PKCS#8 / SPKI / PEM
|
||||
|
||||
Current version: **v3.2.0** (this release adds the `kdf2` / `encoding` / `rand` modules, see [§ New in v3.2.0](#-new-in-v320)).
|
||||
Current version: **v3.2.1** (a performance release: **1.96x** geometric-mean speed-up, see [§ Performance](#-performance-v321) and [`docs/benchmark.md`](docs/benchmark.md)).
|
||||
|
||||
---
|
||||
|
||||
## ⚡ Performance (v3.2.1)
|
||||
|
||||
**v3.2.1 is a pure optimization release.** Every hot path was reworked while
|
||||
keeping the public API, the error semantics and the security properties
|
||||
unchanged. The library is still **100% pure Python, zero dependencies** — no
|
||||
primitive was replaced by a C-backed shortcut.
|
||||
|
||||
| Operation | Speed-up vs v3.2.0 |
|
||||
|---|---:|
|
||||
| Base64 decode | **21.98x** |
|
||||
| Base58 encode | **8.01x** |
|
||||
| ChaCha20-Poly1305 encrypt | **3.54x** |
|
||||
| XChaCha20-Poly1305 encrypt | **3.28x** |
|
||||
| Base64 encode | **2.98x** |
|
||||
| AES-256-GCM decrypt / encrypt | **2.26x** / **2.25x** |
|
||||
| AES-GCM-SIV encrypt | **2.06x** |
|
||||
| AES-256-CTR / ECB / CBC | **2.01x** / 1.96x / 1.88x |
|
||||
| AES single block (256-bit) | 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.** Geometric-mean speed-up over 27
|
||||
> measured operations: **1.96x**.
|
||||
|
||||
Techniques: code-generated fully-unrolled AES / Keccak round functions,
|
||||
big-integer bulk operations for GHASH and POLYVAL, precomputed lookup tables,
|
||||
branch-free constant-time selection, lazy modular reduction in X25519, and
|
||||
batched Base58 / Base64 processing. Full data and methodology are in
|
||||
[`docs/benchmark.md`](docs/benchmark.md).
|
||||
|
||||
---
|
||||
|
||||
@@ -65,6 +99,7 @@ TUI hash / KDF menu crashes, TUI `x25519`/`rsa` unpacking crashes, TUI self-test
|
||||
- [Three Usage Modes](#-three-usage-modes-one-command-three-forms)
|
||||
- [Quick Start](#-quick-start)
|
||||
- [Unified Error System](#-unified-error-system)
|
||||
- [Performance (v3.2.1)](#-performance-v321)
|
||||
- [New in v3.2.0](#-new-in-v320)
|
||||
- [Windows Multiprocessing Notes](#-windows-multiprocessing-notes-important)
|
||||
- [TUI Language Switch](#-tui-language-switch-cn--en)
|
||||
@@ -92,7 +127,7 @@ TUI hash / KDF menu crashes, TUI `x25519`/`rsa` unpacking crashes, TUI self-test
|
||||
> ⚠️ The performance and side-channel characteristics of pure Python make it **unsuitable** for high-throughput, strongly adversarial, long-running production-critical scenarios.
|
||||
> Be sure to read the [Security Notes](#-security-notes) and [`docs/security.md`](docs/security.md).
|
||||
|
||||
Author: **Dvs(DvsXT)** · License: **MIT** · Current version: **v3.2.0**
|
||||
Author: **Dvs(DvsXT)** · License: **MIT** · Current version: **v3.2.1**
|
||||
|
||||
---
|
||||
|
||||
@@ -799,6 +834,6 @@ This project is released under the **MIT License**. See [`LICENSE`](LICENSE) for
|
||||
|
||||
<div align="center">
|
||||
|
||||
**purepycrypto v3.2.0** · Made with ❤️ by **Dvs(DvsXT)**
|
||||
**purepycrypto v3.2.1** · Made with ❤️ by **Dvs(DvsXT)**
|
||||
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user