← Back to section · Open Source Projects

PQClean: The Project Giving Post-Quantum Algorithms 'Clean-Room' Reference Implementations

PQClean does not collect the fastest implementations — only the cleanest: portable C code, a uniform specification, complete test vectors and metadata. Inconspicuous as it is, it supplies the code that downstream projects such as pqm4 evaluate, and it is a key step on the road from academic code to engineering-grade code.

Published 22 November 2026 · 6 min read · PQ Frontier

PQClean: The Project Giving Post-Quantum Algorithms 'Clean-Room' Reference Implementations
AI-generated site artwork
Video explainer · PQC Open Source Projects: from papers to key-exchange code

Between a post-quantum algorithm on paper and code you can actually use sits an inconspicuous but crucial stretch of road: turning the wildly varying styles, unclear dependencies and leftover debugging scaffolding of academic submission packages into auditable, portable, composable engineering code. PQClean (github.com/PQClean/PQClean) does exactly this job — it says it collects “clean” implementations, and that word “clean” has a precise engineering meaning.

What It Takes — and What It Refuses

PQClean collects portable implementations of post-quantum schemes that went through the NIST standardisation process (signatures and KEMs, including the standardised ML-KEM, ML-DSA and SLH-DSA as well as some candidates), under one hard rule: clean implementations only, no optimised ones. Assembly, AVX2 intrinsics and platform-specific tricks are all out of scope — not because that work is unimportant, but because PQClean’s job is to provide baseline code that anyone can read and that compiles anywhere. The speed contest has its own arena (see the benchmarking article in this site’s software section).

This trade-off buys a direct benefit: when an optimised implementation is suspected of a bug, the PQClean version is the most convenient reference — same logic, readable code, and a byte-for-byte output comparison locates the divergence.

An Engineering Specification Written into the Repository

PQClean imposes documented requirements on every implementation, principally:

  • Portable C code: no dependence on specific compiler extensions or operating-system interfaces; the goal is direct compilation on mainstream platforms;
  • Strict compilation checks: the code must build cleanly with strict warning options enabled, and conform to the repository’s code formatting rules;
  • Complete functional tests: every implementation ships test vectors and consistency checks (KEM encapsulation/decapsulation round-trips, signature sign/verify round-trips), wired into the project’s continuous testing;
  • A uniform namespace: exported symbols must carry algorithm and parameter-set prefixes, so that linking several algorithms into one program causes no symbol collisions — the requirement most easily overlooked in “composition” scenarios, and the hardest to retrofit;
  • META.yml metadata: every implementation directory carries a structured metadata file recording the algorithm name, parameter sets, implementation provenance, licence and maintenance status, so downstream tooling can process the collection in bulk, by machine.

These requirements sound fussy, but they are precisely what keeps a collection of “dozens of algorithms × multiple parameter sets” maintainable. Each implementation retains its upstream licence, recorded in its own META.yml, and adopters must check the terms per implementation.

What It Takes to Make an Academic Implementation “Clean”

The typical processing of a reference implementation from a NIST submission package into PQClean goes roughly like this: first strip away code peripheral to the algorithm — command-line demos, file I/O, and randomness interfaces tied to a specific operating system are replaced by uniform conventions; then align the interface to the repository’s prescribed function signatures, so that different parameter sets and different sources of the same algorithm become interchangeable; then add namespace prefixes, clear compiler warnings and reformat to the uniform style; finally attach test vectors and the META.yml, and pass continuous testing on multiple platforms. The process does not change the algorithm itself, yet it regularly exposes hidden assumptions in the original code: hard-coded length fields, code that only holds on machines of one endianness, reliance on uninitialised memory — problems that are hard to notice inside the original submission package but surface immediately inside a uniform test framework. In that sense PQClean is not merely a code repository but a peer-review step: being included means the implementation has survived “being picked up by strangers and compiled and run on strange platforms”. That is its essential difference from a source tarball on an algorithm team’s website — the latter is a release; this is an acceptance test.

There is an added value for teaching and self-learners: production libraries (such as the implementations built into major TLS stacks) add large amounts of optimisation and defensive code in pursuit of performance and security, and a beginner can hardly read the algorithm’s skeleton out of them; PQClean’s versions deliberately stay plain, with the most direct correspondence between data structures, operations and the algorithm specification documents. When university courses and self-learners reach the implementation layer of an algorithm, this is the layer of code they are pointed at.

Its Place in the Ecosystem

PQClean’s most important downstream consumer is pqm4: the PQC benchmarking framework for the ARM Cortex-M4 uses PQClean’s implementations directly as its evaluation subjects, measuring speed, stack usage and code size. Because everyone is measured on the same body of clean code, cross-algorithm comparisons hold up; and a scheme that wants to report optimised numbers must first leave a reproducible baseline here.

Looking upstream, PQClean’s implementations mostly originate from the reference implementations in the algorithm teams’ NIST submissions, flowing back to the community after normalisation. It has thus become a hub: academic implementations “graduate” here into code the engineering world can use, and researchers writing new implementations often model their interfaces and tests on it. For anyone who wants to understand the real data flow of an algorithm, reading PQClean’s code is usually far more efficient than starting from a heavily optimised production library.

Who Should Use It

  • Implementers: treat it as a model of coding standards and testing discipline;
  • Evaluators: treat it as the uniform baseline for cross-algorithm comparison;
  • Teachers: its code is organised precisely to be read.

For production deployment, you should still choose implementations that are specifically audited and continuously maintained (such as the standard implementations in mainstream cryptographic libraries) — PQClean’s value is reference and baseline, not replacing production libraries. Keeping that distinction clear is what it means to use this project correctly. One final note of etiquette: work built on PQClean code (benchmark figures, ported implementations, teaching materials) should credit provenance according to the licence and source conventions recorded in each implementation’s META.yml — that is the foundation on which this “clean code” ecosystem keeps running.

References

  1. The PQClean repository. https://github.com/PQClean/PQClean
  2. The pqm4 project. https://github.com/mupq/pqm4
  3. NIST Post-Quantum Cryptography standardisation project. https://csrc.nist.gov/projects/post-quantum-cryptography

Tags: PQCleanreference implementationsopen source