Verified Garbage: Claude Writes Crypto Assembly, Lean Proves It – With a Catch
The maintainers of pyca/cryptography have released a crypto library whose assembly code was written entirely by AI and is mathematically checked in Lean. We break down what those proofs guarantee and what they don't. The biggest catch: the specs the code is proven against were written by an AI too.

What's going on
On November 28, 2026, the maintainers of pyca/cryptography, one of the most widely used Python libraries, unveiled a new crypto library. It's called Verified Garbage. According to the README, it's “implemented entirely by LLMs.” Even so, it's supposed to be safer than much of what humans write by hand: every crypto routine ships as hand-optimized assembly (the language sitting just above a processor's machine instructions). And every one of those routines is formally verified in the Lean proof assistant, meaning it's checked mathematically, with no gaps, against a specification.
That flips the current debate on its head. Right now, the conversation is about whether AI can break encryption. The new Cryptography Incident Review Group, a coalition of 21 cryptographers, wants to evaluate exactly those cases. Verified Garbage asks the opposite question: can AI make cryptography provably safer? We went through the announcement, source code, commit history and bug tracker. Our verdict: the approach deserves to be taken seriously. But what the proofs actually guarantee is a lot narrower than an “everything is proven” headline would suggest.
Two humans, one AI, 6,060 commits
The announcement post on verified-garbage.dev doesn't name anyone. The GitHub commit history leaves no doubt, though: according to the GitHub API, 3,727 commits come from Alex Gaynor and 2,316 from Paul Kehrer. The repository was created on September 27, 2026. That's roughly 6,060 commits in just over nine weeks, or about 95 a day by our math. Every commit we looked at lists Claude as co-author. Several carry the line “Co-Authored-By: Claude Opus 5.5” and a link to a Claude Code session. Even the earliest commit we found is tagged that way. It sets up the processor model for ARM64.
The authors describe the division of labor like this: humans set the direction, LLMs write the specifications, the assembly and the proofs. The trick: because Lean checks every optimization, you can let the LLMs “run free.” The code can get as clever as it likes, as long as the proof goes through. They cite AWS's s2n-bignum and Joe Birr-Pixton's Graviola library as inspiration.
According to the README, it covers every algorithm pyca/cryptography uses. That ranges from SHA-2, SHA-3 and BLAKE2 through AES-GCM and ChaCha20-Poly1305 to RSA, ECDSA, Ed25519 and Ed448. Add to that the post-quantum schemes ML-KEM and ML-DSA. Six architectures are supported: x86, x86-64, ARMv7, ARM64, PPC64LE and RISC-V 64. Even legacy algorithms like RC4, IDEA and Blowfish get verified assembly versions.
What's proven – and what isn't
The README is remarkably candid about its limitations. We've sorted them:
| Area | Status |
|---|---|
| Assembly routines: output matches the specification | proven in Lean |
| Memory safety of the routines (no reads/writes outside permitted ranges) | proven in Lean |
| Constant time: instruction sequence and memory addresses don't depend on secrets | proven in Lean, but under assumptions (see below) |
| Public Rust APIs, e.g. length limits for AES-GCM, call order, HMAC with long keys | only tested, including with Wycheproof test vectors |
| Spectre and other speculative attacks | explicitly not modeled, no mitigations |
| scrypt | exception: reads memory at password-dependent locations; the standard requires it |
| ML-KEM/ML-DSA | exception: some hashes of secrets are allowed to “leak” |
Wycheproof is a collection of test cases started by Google that probes crypto code for known pitfalls. But a test only shows that specific cases work. A proof holds for every input.
For ML-KEM and ML-DSA, the README concedes that the theorems guarantee “much less than” full independence from secrets. By current thinking, though, the permitted leaks aren't useful to an attacker. Then there are assumptions about the hardware. Constant time here means the sequence of instructions gives nothing away. Whether each individual instruction always takes the same amount of time is assumed, not proven. On x86, this relies on Intel's guidance on data-independent timing. According to the README, on newer Intel chips that only holds if the operating system sets a specific control bit (DOITM). It covers neither AMD processors nor the SHA-512 instructions. On ARM64, the DIT mode has to be active, and the library turns it on itself. On POWER10 and later, multiplication timing isn't guaranteed. Our note: the maintainers' own benchmarks ran on an AMD processor, where the x86 guarantee formally doesn't apply.
The core question: who checks the checkers?
A proof only shows that the code does what the specification says. If the specification is wrong, the proven code is wrong too. That's why the authors call the specifications of the algorithms and instruction sets their trusted computing base: the part you have to take on faith because it can't be proven itself. The announcement says:
“These specifications form our trusted computing base and must be reviewed by hand to establish correctness.”
And further: they too “were written by LLMs and then reviewed by humans.” According to lean/README.md, this doesn't just include the algorithm specs. It also covers the processor models, the generator that produces Rust code from Lean, and LLVM's assembler. For ARM code, the text is handed straight to the assembler.
The bug tracker shows this base isn't infallible. In November, outside reviewers reported a whole series of holes. Some examples:
- Flag model (issue #5322): Undefined processor flags were treated as “equal” in the model. That meant a proof could wave through code that, on an Intel Core Ultra 7 270K, leaks through the flags whether a secret product is zero. According to the report, no shipped code was affected. The hole has been fixed. The kicker: the report itself was, by its own account, written with Claude Opus 5.5.
- Stack memory model (#5321): The model kept the bytes of a freed memory region. So a proof could rely on values that real hardware might already have lost.
- Uninitialized reads (#6435): The Valgrind analysis tool found reads of never-written memory in SEED, SM4, Triple-DES and Camellia. The maintainers considered this harmless and closed the issue. They did, however, document two previously unstated model assumptions.
- Generator (#6303): An unchecked name field could be used to sneak in unproven Rust functions. No abuse was found in shipped code.
Our take: these findings actually speak for the approach. They show where to look. Anyone who wants to audit the project doesn't have to read millions of lines of assembly, just a clearly bounded core. But they also show that “reviewed by humans” is no guarantee on its own.
The maintainers know this. They may replace the LLM specifications with human-written ones maintained by the community. There's an open issue in the tracker about “Wychelean.” When someone suggested using the established Sail processor models from academia, Gaynor was hesitant: they lack properties such as whether an instruction's timing depends on its data.
The problem isn't new. Karthikeyan Bhargavan of the HACL* team wrote in February that they had “twice found bugs in the high-level specifications” they had verified against. And Microsoft, according to its own blog, also has AI agents translate standards into Lean specifications that humans then review. Verified Garbage just goes one step further, because the processor models come from the AI as well.
How fast is the “garbage”?
The announcement shows charts for an AMD Ryzen 9 9950X and an Apple M1 Max, measured against OpenSSL 4.1.0 and AWS-LC 5.12.0. But the numbers only appear in the charts, not in the text. Concrete figures can be found in an internal tracking issue (#4932). There, the maintainers measured on the Ryzen 9 9950X against OpenSSL 3.5.5 and aws-lc-rs 1.18. So these are self-reported numbers against older versions:
| Algorithm | Result per issue #4932 |
|---|---|
| ML-KEM | approx. 2.5× faster than AWS-LC |
| X25519, Ed25519 | takes 60–75% of AWS-LC's time |
| RSA (public operations) | approx. 2× faster |
| AES-GCM (TLS) | takes 50–90% of the faster competitor's time |
| Triple-DES (serial modes) | 11–15× slower than OpenSSL |
| BLAKE2b, 16 KiB | 1.55× slower |
| RSA-3072 private | approx. 6% slower |
We didn't find any independent benchmarks. According to the authors, most of the optimization work went into x86-64 and ARM64.
How it compares: who verifies what?
| Project | Tool | Verified | Specifications |
|---|---|---|---|
| Verified Garbage | Lean | Assembly, 6 architectures, correctness + memory safety + constant time | LLM-written, human-reviewed |
| s2n-bignum (AWS) | HOL Light | Assembly for x86-64/ARM64; constant time per README “not currently rigorously machine-checked” | in the proof scripts; LLMs reach at most 6.35% zero-shot on s2n-bignum-bench |
| HACL*/libcrux | F*/hax | Correctness, memory safety, secret independence at source level; not binaries | hand-written |
| fiat-crypto | Coq | generates proven field arithmetic, ships in BoringSSL/Chrome | hand-written |
| SymCrypt (Microsoft) | Aeneas + Lean | Rust code for ML-KEM and SHA-3, functional correctness | AI agents draft, humans review |
No other project combines this many algorithms, six architectures and timing proofs. But none has as little production experience either. SymCrypt's code already runs in Windows Insider builds, and fiat-crypto in Chrome.
Try it
The library is on crates.io/crates/verified-garbage. It needs Rust 1.95 or newer and you add it with cargo add verified-garbage. There's no build script; the assembly lives directly in the Rust code as “naked functions.” For TLS, there's the rustls provider rustls-verified-garbage. It supports TLS 1.2 and 1.3, X25519, P-256/P-384, ML-KEM and the hybrids X25519MLKEM768 and SECP256R1MLKEM768. One catch: it's pinned to the prerelease rustls 0.24.0-dev.3. HPKE, which Encrypted Client Hello needs, is missing. According to the README, you can't use the compiler options for branch protection (-Zbranch-protection=bti, -Zcf-protection=branch). Stack traces through the crypto functions may be broken. The source code is at github.com/pyca/verified-garbage.
Our take
Verified Garbage is the most ambitious public experiment yet in getting AI and formal proofs to work together: the AI can optimize as creatively as it wants, because Lean double-checks every step. As a mechanism, that's a strong argument. A bad proof won't get through, no matter who writes it.
But the trust only shifts, it doesn't disappear. Instead of assembly, humans now have to review specifications and processor models, and those were written by an AI too. The string of bugs in November shows real holes can hide there. The Rust layer is only tested, Spectre is out of scope, and the timing guarantee hinges on vendor promises. There are no independent audits or benchmarks. Even the Hacker News submissions haven't drawn any discussion so far.
Our assessment: version 0.1.0 isn't ready for production systems, and the authors say so themselves. They don't plan to replace OpenSSL in pyca/cryptography for now. But as a test of whether AI can not only break crypto code but provably secure it, the project is fascinating. Whether it holds up will come down to one question: who writes the specifications going forward.
Sources
- Ankündigung: Announcing Verified Garbage verified-garbage.dev
- GitHub: pyca/verified-garbage github.com
- README (raw) raw.githubusercontent.com
- lean/README.md – Trusted Computing Base raw.githubusercontent.com
- GitHub-API: Contributors api.github.com
- GitHub: Commit-Historie github.com
- Issue #4932: AVX-512-Performance vs OpenSSL und aws-lc github.com
- Issue #5322: NoResidue und undefinierte Flags github.com
- Issue #6435: Uninitialisierte Stack-Lesezugriffe github.com
- Issue #6303: Unbewiesene Rust-Funktionen über Suffixe github.com
- Issue #6766: Sail-ISA-Spezifikationen github.com
- docs.rs: rustls-verified-garbage docs.rs
- GitHub: awslabs/s2n-bignum github.com
- arXiv: s2n-bignum-bench arxiv.org
- Microsoft Research: Verifying Rust cryptography in SymCrypt microsoft.com
- Bhargavan: The strengths and limits of formal verification pereq.eu
- GeekNews (KR) mit Lobsters-Diskussion news.hada.io
Ask the AI assistant
Questions about this article, installation or background? Our assistant knows this page and runs on our own machine, not in someone else's cloud.
The Assistant is an AI (Gemma 4) and can make mistakes – please check important details against the source. Questions are used only to generate an answer and are deleted after one hour. Please don't enter any personal data.
Comments
What do you think? Already tried it? Write it here, no sign-up needed.
Comments are public. Links aren't allowed, and we delete abusive posts. You can delete your own comment at any time in this browser. Learn more in the Privacy Policy.