The Verified Garbage cryptography library is a new experiment in writing every algorithm in assembly and then proving the assembly correct. It comes from two maintainers of the widely used pyca/cryptography project, and it leans on large language models to produce the optimized code at a scale no small team could write by hand.
The name is deliberate. It plays on “garbage in, garbage out,” a line from Charles Babbage, and on the fact that plenty of people will see an LLM-assisted crypto library as slop. The authors say so themselves.
How the verification works
Cryptography libraries pull in different directions. Assembly runs fast but is hard to review. High-level languages make buffer overflows and undefined behavior easier to avoid, but make it harder to guarantee constant-time execution. Verified Garbage tries to sidestep the choice.
The team writes Lean specifications for each algorithm, such as AES-GCM or X25519. They also write specifications that model the instructions and behavior of each CPU instruction set. Then they write assembly for every algorithm on every architecture and prove two things: the assembly matches the specified algorithm, and it runs in constant time. Here, constant time means the instruction trace doesn’t depend on secret inputs, and no instruction that touches secret data has data-dependent timing.
Because the proofs guard safety, the assembly can get as aggressive as the authors like. The approach is inspired by AWS’s s2n-bignum library.

What the library covers
The authors point to three things that set it apart:
- Every cryptographic algorithm used by pyca/cryptography is supported and formally verified.
- It runs on x86, x86-64, ARMv7, ARM64, PPC64le and RISCV64.
- The verification setup let them optimize hard and reach strong performance.
The library ships as a Rust package and can be added with cargo add verified-garbage. A separate crate provides a rustls crypto provider, so Rust applications can use it for TLS.

Benchmarks and their limits
The team runs a benchmark suite across every algorithm, using it to catch regressions and to compare against other libraries. Rustls benchmarks measure end-to-end performance in real applications. The published comparisons covered ML-KEM, ML-DSA, ECDH, ECDSA, RSA PKCS#1, RSA PSS, AES-128-GCM, ChaCha20Poly1305, SHA256 and HMAC-SHA256, plus TLS 1.3 handshakes and bulk data.
Tests ran on an AMD Ryzen 9 9950X with Ubuntu 26.04 pinned to one core, and on an Apple M1 Max running macOS 27. The reference points were OpenSSL 4.1.0 built from source and AWS-LC 5.12.0 as bundled in aws-lc-rs 1.19.0. Results are throughput relative to OpenSSL at 1.0. For the rustls tests, the baseline is AWS-LC instead.
The authors add a warning. Relative performance varies by instruction set and by which extensions a CPU supports, and x86-64 and ARM64 with modern extensions are the targets they have tuned most.

Where the trust still sits
Proofs remove the need to review the assembly. They don’t remove the need to review the specifications. The Lean specifications for algorithms and instruction sets form the trusted computing base, and those must be checked by hand. LLMs drafted those specifications too, and humans then reviewed them.
The authors frame the project as two observations. First, given a trusted base, LLMs are effective at repeatedly improving performance and then proving the changes valid. Second, the team can build that base and turn it into a useful library. They expect skepticism toward any new crypto library, especially one built with heavy LLM use, and describe the work as an experiment that needs time and feedback.
One question is already obvious. Since the same two people maintain pyca/cryptography, would they swap out its OpenSSL dependency? Not now. They say it’s on their minds, but they have technical and social work to do first, and any switch would have to go smoothly for users.
What the team plans next
Optimization comes first. There are many algorithms and many architectures, and the goal is the fastest implementation of each on every CPU.
The second goal is a stronger trusted base. One option is to replace the LLM-written specifications with human-authored ones maintained by the community. The team also wants to hear from potential users about what would make the library worth adopting.
The project credits AWS’s s2n-bignum, Joe Birr-Pixton’s graviola and Bobby Powers as inspirations, along with people the authors met at Real World Crypto and the High Assurance Cryptography Software Workshop.
Source: verified-garbage.dev