← Back to section · Software & Developer Tools

Implementation Lineages: Reference Code, PQClean, and Optimized Variants

The family tree of post-quantum implementations — submission-package reference code, PQClean's clean-code line, platform-optimized variants — and how production libraries draw from each.

Published 22 November 2026 · 6 min read · PQ Frontier

Implementation Lineages: Reference Code, PQClean, and Optimized Variants
AI-generated site artwork
Video explainer · PQC libraries: algorithms become code

Discussions of an algorithm’s “implementation” often assume there is exactly one. The reality is the opposite: an algorithm in the standardization spotlight usually has three or four implementations of different bloodlines — one written to prove the algorithm works, one cleaned up for audit, one tuned to run as fast as possible on particular silicon. Confusing the lineages leads to wrong material choices: teaching code carrying production traffic, or heavily optimized assembly submitted to a compliance review. This article maps the family tree.

Generation one: reference implementations in the submission packages

In the NIST process, every candidate’s submission package shipped a reference implementation. Its mission was to define the algorithm: to express the specification in the most straightforward code possible, giving reviewers and other implementers a “standard answer” to compare against. Reference implementations therefore pursue correctness and readability; performance and side-channel resistance are usually outside their goals — some are explicitly not constant-time.

The correct way to use a reference implementation is as a ruler: once a new implementation is written, generate or verify test vectors against it and compare outputs byte for byte. It should not be carried directly into systems with performance or side-channel requirements. Deploying reference code as production code is the most common misuse in the lineage tree, and the first provenance question a security review should ask.

The clean-up line: PQClean’s tidy-code route

Submission code varies in style and dependencies, which makes direct integration into other projects friction-heavy. PQClean did the tidying: it rewrote the implementations of algorithms advancing through the rounds into uniformly styled C — consistent naming, consistent interfaces, no external dependencies, and a uniform test harness — so downstream projects could consume them like parts. Its objective function was auditability and integrability: the more regular the code, the easier human review and static analysis become, and the fewer surprises integration produces.

PQClean has been archived after completing its phase mission and no longer tracks new standards, but its cleaned output was absorbed by many downstream projects, and its “clean implementation” methodology — uniform interfaces, stripped dependencies, test vectors travelling with the code — became the template by which many libraries organize implementation code. The lineage’s fingerprints are still visible when assessing a library’s provenance today: the portable C implementations in quite a few libraries descend from, or borrow from, this clean-up line.

The optimization line: born for specific platforms

The third lineage exists for speed: implementations optimized for particular instruction sets and microarchitectures — versions using vector instructions to process polynomial arithmetic in parallel, versions trimmed for constrained microcontrollers (such as the pqm4 ecosystem for Cortex-M parts), and platform-optimized code maintained inside production libraries. Their common trait is tight hardware coupling: the same algorithm can differ severalfold in speed between portable C and a vectorized variant, while readability drops, review gets harder, and the branching and memory-access patterns introduced by optimization need their own side-channel assessment.

Optimized implementations carry an implicit lineage duty: their behavioural equivalence with the reference implementation must be proven continuously by test vectors. Responsible production libraries run optimized and portable variants against the same correctness suite and regress it on every release. When selecting, asking “what proves your optimized path is equivalent to the reference?” often reveals more about a library’s engineering quality than any benchmark.

Production sourcing: lineage awareness is security awareness

With the three lineages side by side, a production library’s daily work becomes clear: hold reference implementations and official test vectors as the correctness ruler, keep clean implementations as the maintainability floor, and introduce regression-proven optimized variants on hot paths. liboqs is organizationally a sample of this multi-lineage assembly: several implementations of one algorithm coexist, with build options deciding which is active.

For users, the lesson is to add “implementation provenance” to the selection checklist: from which lineage does this library’s implementation of the target algorithm come? Is it validated against official test vectors? Can the optimized path fall back to the portable one? These questions are unglamorous, yet they decide directly whether a delivered system holds up under audit and incident review. Choosing the right algorithm is only the first half; choosing the right implementation is the whole match.

Beyond the tree: the quiet line of formally verified implementations

Strictly speaking there is a fourth line: implementations built for formal verification. This work rewrites core algorithms in languages or toolchains carrying machine-checkable proofs, turning “the implementation matches the specification” from a testing question into a proof question; the core components of some high-assurance cryptographic libraries come from exactly this line. Its cost is very high and its coverage limited, so it will not become the mainstream source for general libraries soon, but within the family tree it marks the ceiling of attainable confidence and provides high-assurance reference points for the other lineages.

For ordinary selectors, this quiet line’s value is a template for questioning: does this library offer any correctness argument beyond ordinary testing for its most sensitive components — random sampling, the rejection logic inside decapsulation, and the like? Even an answer of “the critical paths share test vectors with a verified implementation” is closer to fact than a vague claim of military-grade security. The endpoint of lineage awareness is not memorizing the family tree but acquiring the habit of asking every implementation two questions: where do you come from, and what proves you right?

A reader’s quick lineage guide

A quick-reference for placing an implementation’s bloodline from its documentation and repository: code labelled as a reference implementation, deliberately plain in structure, is most likely the ruler that defines the algorithm; code with tidy interfaces, uniform naming, and a stated absence of external dependencies most likely descends from the clean line; code organized by instruction set or chip model, accompanied by substantial assembly, is an optimized variant; and code explicitly claiming machine-checked proofs belongs to the verified line. Complete this classification first in selection and audit work, then discuss performance and applicability, and the discussion will stay at the right level.

References

Tags: PQCleanreference implementationoptimized implementationlineages