Quick decision table: which PQC algorithm to pick
Post-quantum cryptography splits cleanly into two jobs—key establishment (KEM) and digital signatures—just like classical ECDH and ECDSA. The four standards developers actually deploy map directly to four concrete use cases:
| If you need to… | Pick | Why | Try Locally |
|---|---|---|---|
| Establish keys for web apps, HPKE, or file encryption | X-Wing (ML-KEM-768 + X25519) | Defense-in-depth hybrid; 32-byte seed; secure if either ECC or lattice holds. | X-Wing Generator → |
| Meet NSA CNSA 2.0 key establishment mandates | ML-KEM-1024 (FIPS 203) | Category 5 (~AES-256) pure PQ KEM with RFC 9935 / OpenSSL 3.5+ PEM support. | ML-KEM Generator → |
| Sign TLS certs, APIs, packages, or CNSA 2.0 artifacts | ML-DSA-87 / ML-DSA-65 (FIPS 204) | Fast signing & verification with manageable 3.3–4.6 KB signatures. | ML-DSA Generator → |
| Anchor 20-year Root CAs or firmware with zero lattice risk | SLH-DSA (FIPS 205) | Pure hash-based math (SHA-2 / SHAKE256), stateless, tiny 32–64 B public keys. | SLH-DSA Generator → |
Complete key, ciphertext & signature size matrix
Use this reference table when sizing database columns, ASN.1 certificates, HTTP headers, and wire frames:
| Algorithm | Role | Math Basis | Public Key | Private Key | Ciphertext / Sig | Quantum Safe? |
|---|---|---|---|---|---|---|
X25519 (Classical ECDH) | Key Exchange | Elliptic Curve | 32 B | 32 B | 32 B (ephemeral) | No |
Ed25519 (Classical Sig) | Signature | Elliptic Curve | 32 B | 32 B seed | 64 B sig | No |
RSA-4096 (Classical) | KEM / Sig | Factoring | 512 B | ~2.3 KB | 512 B | No |
ML-KEM-768 (FIPS 203) | KEM | Module Lattice | 1,184 B | 64 B seed (2,400 B exp) | 1,088 B ct | Yes (L3) |
ML-KEM-1024 (CNSA 2.0) | KEM | Module Lattice | 1,568 B | 64 B seed (3,168 B exp) | 1,568 B ct | Yes (L5) |
X-Wing (ML-KEM-768+X25519) | Hybrid KEM | Lattice + ECC | 1,216 B | 32 B seed | 1,120 B ct | Yes (Hybrid) |
ML-KEM-1024 + P-384 | Hybrid KEM | Lattice + ECC | 1,665 B | 32 B seed | 1,665 B ct | Yes (CNSA Bridge) |
ML-DSA-65 (FIPS 204) | Signature | Module Lattice | 1,952 B | 32 B seed (4,032 B exp) | 3,309 B sig | Yes (L3) |
ML-DSA-87 (CNSA 2.0) | Signature | Module Lattice | 2,592 B | 32 B seed (4,896 B exp) | 4,627 B sig | Yes (L5) |
SLH-DSA-SHA2-128s (FIPS 205) | Signature | Hash-Only (SHA-2) | 32 B | 64 B | 7,856 B sig | Yes (L1) |
SLH-DSA-SHA2-256s (FIPS 205) | Signature | Hash-Only (SHA-2) | 64 B | 128 B | 29,792 B sig | Yes (L5) |
SLH-DSA-SHA2-256f (FIPS 205) | Signature | Hash-Only (SHA-2) | 64 B | 128 B | 49,856 B sig | Yes (L5) |
Key exchange: Pure ML-KEM vs. Hybrid X-Wing
ML-KEM (FIPS 203) is fast and standardized, and ML-KEM-1024 is the mandatory CNSA 2.0 choice. So why does X-Wing (ML-KEM-768 + X25519) exist?
- Hedging against unexpected cryptanalysis: Elliptic curves have been battle-tested for decades against classical attacks, while structured lattices are newer. X-Wing combines both shared secrets with SHA3-256 so an attacker must break both X25519 and ML-KEM-768 to recover the session key.
- Negligible overhead: Adding X25519 to ML-KEM-768 adds only 32 bytes to the public key (1,184 B → 1,216 B) and 32 bytes to the ciphertext (1,088 B → 1,120 B), while shrinking the private seed to just 32 bytes.
- CNSA Bridge option: For regulated environments transitioning from CNSA 1.0 to CNSA 2.0,
ML-KEM-1024 + P-384combines NIST P-384 with ML-KEM-1024 in one exchange (available on our X-Wing & Hybrid KEM Generator).
Signatures: Lattice ML-DSA vs. Hash-only SLH-DSA
Both ML-DSA (FIPS 204) and SLH-DSA (FIPS 205) are stateless post-quantum digital signature schemes—you can sign millions of messages safely without tracking a monotonic counter (unlike stateful LMS/XMSS, where reusing a state index catastrophically leaks the private key).
- Pick ML-DSA when size and speed matter: ML-DSA-87 signs and verifies in fractions of a millisecond with 4.6 KB signatures—roughly 6–10× smaller than SLH-DSA-256. It is the default for TLS certificates, signed APIs, and CNSA 2.0.
- Pick SLH-DSA when cryptographic conservatism matters most: SLH-DSA's security reduces strictly to the collision/preimage resistance of SHA-2 or SHAKE256—no lattices, no new algebra. Its public keys are only 32–64 bytes (great for hardware ROM / root anchors), trading off much larger 7.8–49.9 KB signatures.
-f (fast signing, larger signatures—good for CI/CD
signing) and -s (smaller signatures, slower signing—good for offline Root CAs and infrequently signed
firmware images).
Protocol wire budgets (TLS, JWTs, Cookies, DNSSEC, DB columns)
- Browser Cookies (4,096-byte cap): An ML-DSA-87 signature alone is 4,627 bytes raw (~6.1 KB Base64URL), meaning an asymmetric ML-DSA JWT will not fit in a single browser cookie. Use opaque random session tokens (OAuth Token Generator) or symmetric
HS384/HS512cookies (JWT Secret Generator) instead. - HTTP Headers (typically 8–16 KB limit): Passing ML-DSA-87 tokens in
Authorizationheaders can push reverse proxies (Nginx/Envoy/ALB) near default 8 KB header buffers—test header limits before rolling out asymmetric PQC tokens. - TLS 1.3 Certificate Chains: A 3-cert ML-DSA-87 chain adds ~20+ KB to the handshake compared to ~2 KB for ECDSA. Keep chains shallow (leaf + intermediate) and ensure TCP/QUIC initial congestion windows handle the larger flight cleanly.
- Database Schemas: Audit any column typed
VARCHAR(255)orVARCHAR(1024)storing public keys, PEMs, or detached signatures—useTEXTorBYTEA/BLOBfor cryptographic agility.
Reference envelope encryption pattern (X-Wing + AES-256-GCM)
Remember: KEMs never encrypt your files or JSON directly—they establish a fresh 256-bit symmetric key that feeds AES-256-GCM:
// Modern post-quantum envelope encryption: X-Wing KEM + AES-256-GCM
import { ml_kem768_x25519 } from '@noble/post-quantum/hybrid.js'
async function sealPayload(plaintext: Uint8Array, recipientPublicKey: Uint8Array) {
// 1. Hybrid KEM derives a fresh 256-bit shared secret (secure if X25519 OR ML-KEM-768 holds)
const { cipherText: kemCipherText, sharedSecret } = ml_kem768_x25519.encapsulate(recipientPublicKey)
// 2. Import the 32-byte shared secret directly as an AES-256-GCM key
const aesKey = await crypto.subtle.importKey('raw', sharedSecret, 'AES-GCM', false, ['encrypt'])
const nonce = crypto.getRandomValues(new Uint8Array(12))
// 3. Encrypt bulk data with quantum-safe AES-256-GCM
const encrypted = new Uint8Array(
await crypto.subtle.encrypt({ name: 'AES-GCM', iv: nonce }, aesKey, plaintext)
)
return { kemCipherText, nonce, encrypted }
}Frequently asked questions
Can I put an ML-DSA-87 JWT inside an HTTP cookie?
No—an ML-DSA-87 signature is 4,627 bytes raw (~6.1 KB Base64URL), exceeding the ~4 KB per-cookie browser limit. Use server-side opaque session IDs or symmetric HMAC-SHA384/SHA512 (which are already quantum-safe and compact) for cookies.
Is SLH-DSA part of NSA CNSA 2.0?
CNSA 2.0 currently specifies ML-DSA-87 for general signatures and stateful LMS / XMSS for firmware/software signing. NIST standardized SLH-DSA (FIPS 205) as the stateless hash-based alternative for commercial, archival, and long-lived PKI use cases where stateful counter management is risky.