This implements ultimate2026 SPEC.md v0.2 in full:
- U26-SIG
- U26-KEM and U26-ENC
- U26-NIKE and the U26-HS handshake, with its transport records
- key bundles and protected private keys
- generation and checking of the official test vectors
It is reference quality. The code follows the spec section by section and favors clarity over speed. It is not constant time: the pure-Python curve code, BIP-340, SM2, GOST and CSIDH-4096 leak timing. Do not use it to protect real secrets.
../scripts/build-deps.sh # pinned liboqs 0.17.0-rc1 + libntruprime (native components)
python3 -m venv .venv
.venv/bin/pip install -e '.[test]'
.venv/bin/python -m pytest # fast suite; add -m slow for the CSIDH handshake test
.venv/bin/python -m u26.vectors check ../vectorsThe native libraries are loaded from ../third_party/prefix/lib. Set U26_NATIVE_LIB to load them from elsewhere.
from u26 import generate, PROFILE_SIG_MAX, PROFILE_KEM_MAX
from u26 import sig, enc
signer = generate(PROFILE_SIG_MAX)
s = sig.sign(signer, b"message", ctx=b"my-app")
assert sig.verify(signer.public, b"message", s, ctx=b"my-app")
alice = generate(PROFILE_KEM_MAX)
c = enc.encrypt([alice.public], b"secret", aad=b"header")
assert enc.decrypt(alice, c, aad=b"header") == b"secret"| Components | Backend |
|---|---|
| RSA, ECDSA/ECDH on P-521 and brainpoolP512r1, Ed25519/Ed448, X25519/X448, ML-DSA-87, ML-KEM-1024 | pyca/cryptography (OpenSSL 3.5) |
| BIP-340, SM2, GOST R 34.10-2012 and the curve arithmetic for the SM2 and GOST curves | pure Python (ecc.py, components.py). Checked against the BIP-340 vectors, gmssl and gostcrypto. |
| Streebog-512 | gostcrypto |
| SM3 | hashlib (OpenSSL) |
| BLS12-381 | py_ecc |
| CSIDH-4096 | pure Python with gmpy2 (csidh.py). Checked against the SQALE C implementation. |
| ffdhe8192 | gmpy2. The prime is derived from its RFC 7919 definition. |
| All other post-quantum components | liboqs and libntruprime via ctypes (native.py) |
| KMAC256 | built on pycryptodome's cSHAKE256 (sym.py) |
| BLAKE3 | the blake3 package |
On a 2026 desktop core:
| Operation | Time |
|---|---|
| Signing key generation | ~1 s |
| Signing | ~2 s |
| Verification | ~0.5 s |
| KEM key generation | ~0.2 s |
| Encryption and decryption | sub-second |
| CSIDH-4096 group action | ~23 s |
The CSIDH cost dominates U26-NIKE and U26-HS. A full handshake takes several minutes in this implementation.