← Back to section · Software & Developer Tools

RustCrypto's PQC Jigsaw: How Small Crates Assemble the Algorithm Map

How RustCrypto combines shared trait abstractions with single-algorithm crates, how the ml-kem and ml-dsa pieces fit, and what to verify piece by piece when adopting it.

Published 22 November 2026 · 6 min read · PQ Frontier

RustCrypto's PQC Jigsaw: How Small Crates Assemble the Algorithm Map
AI-generated site artwork
Video explainer · PQC libraries: algorithms become code

The cryptographic map of the Rust ecosystem is not a single building but a box of jigsaw pieces. The RustCrypto project splits algorithms into small, independent crates, each doing exactly one thing, joined by shared trait abstractions. As the post-quantum era arrived, the jigsaw began to gain lattice-based pieces. This article explains how the structure works, how far the post-quantum section has come, and how to verify the pieces one by one when adopting it.

Structure: traits are the jigsaw’s connectors

A jigsaw holds together through uniform connectors. RustCrypto defines shared trait abstractions for capabilities such as key encapsulation, digital signatures, and hashing, housed in dedicated trait crates; each algorithm crate implements the relevant traits and exposes a consistent method shape. Upper-layer code can therefore program against the traits: swapping an algorithm implementation leaves the caller’s code structure essentially unchanged — only the imported crate and type parameters move.

Inside a single-algorithm crate, parameter sets are organized as types: for key encapsulation, each security level is a distinct concrete type, key and ciphertext sizes are fixed at the type level, and the compiler catches size mismatches at compile time. This “parameters in the types” approach is characteristic of the Rust ecosystem; it moves many errors that C libraries can only surface at runtime to compile time, at the cost of type signatures that look elaborate on first contact.

The post-quantum pieces: ml-kem and ml-dsa first

The first two finished pieces of the post-quantum jigsaw are the ml-kem and ml-dsa crates, corresponding to FIPS 203 and FIPS 204. They implement the standardized key encapsulation and signature algorithms, provide parameter types for the security levels, and implement the ecosystem’s common traits so they compose with other crates such as key derivation and protocol frameworks. Work on areas such as hash-based signatures proceeds in corresponding crates as well; for coverage, consult each crate’s current documentation on docs.rs — uneven completion across pieces is the nature of a jigsaw, and blanket statements mislead.

Also distinguish the jigsaw from a finished machine: RustCrypto provides algorithm-layer components, not protocol stacks such as TLS. A complete protocol usually requires composition with a protocol-layer project, and which cryptographic backend such a project adopts follows its own roadmap. Reading “an algorithm crate exists” as “the whole chain is ready” is a common over-inference when evaluating the Rust route.

Adoption notes: verify piece by piece, not wholesale

The jigsaw structure refines selection granularity from “choose a library” to “choose a set of crates”, and the verification list grows accordingly: each target crate’s version status and release cadence, whether it has had third-party audits or formal verification, the completeness of its documentation and test vectors, and whether its trait versions are compatible with the rest of your assembly. The good news is that this information is comparatively transparent in the Rust ecosystem: documentation sites, repository activity, and dependency graphs are publicly inspectable, so piece-by-piece verification, while laborious, is feasible.

Combined with Rust’s memory-safety properties, the structure suits newly written, long-lived system components particularly well: building algorithms as replaceable jigsaw pieces from the first line of code is what cryptographic agility looks like at the code-structure level. For existing systems, be realistic: if the main body is outside the Rust ecosystem, introducing a separate Rust component chain for post-quantum algorithms adds build and operations cost, and whether it is worth it depends on how clean the component boundary is. A fine jigsaw still has to be assembled on somebody’s table.

Dependency trees and supply chain: the jigsaw’s other face

The jigsaw structure has one more underappreciated consequence: the shape of the dependency tree. Pulling in one algorithm crate typically brings its trait crates, low-level array and numeric-type crates, and neighbouring components such as randomness and digests. Each is small alone; together they form a dependency tree that needs managing — version compatibility is coordinated by the ecosystem’s versioning policy, but tracking security advisories, aggregating licence review, and maintaining build reproducibility fall on the user.

Mature Rust teams have established tooling and process for exactly this: dependency inventories can be generated automatically, security advisories have public databases to subscribe to, and lockfiles keep builds reproducible. Folding post-quantum crates into that existing process is not expensive; the failure mode is treating an algorithm crate as an ordinary business dependency and casually bypassing the organization’s supply-chain review. Extra caution with post-quantum components is justified: they handle the most sensitive key material in the system, and their dependency trees deserve the same scrutiny as core components.

From another angle, the jigsaw structure is actually friendly to supply-chain review: each crate has a single responsibility and a small codebase, so reading a core implementation end to end is not a fantasy — a sharp contrast with monolithic C libraries of hundreds of thousands of lines. Review effort should go first to the most sensitive paths — key generation, randomness sampling, decapsulation — and the jigsaw concentrates exactly those paths in a few small crates, objectively lowering the bar for deep review.

Jigsaw versus monolith: the trade-off side by side

Placing the jigsaw route next to the monolithic-library route sharpens the trade-off. A monolith wins on integrate-once completeness: algorithms, protocols, and certificate handling arrive in a single dependency, with version consistency guaranteed by the library’s maintainers; the price is that size and attack surface come with the full feature set, and there is no handle for trimming. The jigsaw wins on precision and replaceability: only the needed algorithm pieces are imported, each independently upgradable and reviewable; the price is that integration and version coordination shift onto the user, and dependency-tree governance becomes routine work.

Post-quantum migration happens to amplify one jigsaw advantage: algorithms are still in their evolution phase, and the probability of replacing an algorithm piece in the future is markedly higher than in the classical era. In a system built from replaceable pieces, replacement costs one dependency change; in a system with algorithms welded deep inside a monolith, it can cost a platform migration. The precondition, of course, is that upper-layer code genuinely programs against the trait abstractions rather than hard-coding concrete types at every call site — the jigsaw provides the possibility, and only discipline redeems it as agility.

References

Tags: RustCryptoRustcratesmodularity