Building Cobalt-769: Beating ML-KEM on Wire Size Without Cyclotomics or Unsafe Rust

Chaitanya Mishra · Chony · December 2026

ML-KEM is a good standard. I want to say that up front, because the rest of this post is about the ways we tried to beat it, and most of those ways failed. Some failed quietly in a notebook. Some failed after we had written a constant-time implementation, a KAT generator and a dudect harness for them, which is the expensive way to fail.

What survived is Cobalt-769: a single-polynomial NTRU-LWR KEM over the field $\mathbb{F}_{769}[x]/(x^{769}-x-1)$, with a 922-byte public key and an 817-byte ciphertext. That is 1,739 bytes on the wire, 23.5% less than ML-KEM-768, with higher numbers from both standard lattice estimators, no cyclotomic ring, no subfield tower, no nontrivial automorphisms, and an implementation that runs encapsulation in 17.9 µs on an AMD EPYC 9B45 under #![forbid(unsafe_code)].

This is the long version of how we got there, including the parts we'd rather not have needed.

The starting line

The thing to beat is ML-KEM-768. Its public key is 1,184 bytes and its ciphertext is 1,088 bytes, so a handshake moves 2,272 bytes of KEM material. Good AVX2 implementations do an operation in roughly 15–20 µs. The ring is $\mathbb{Z}_{3329}[x]/(x^{256}+1)$, a power-of-two cyclotomic, arranged as a rank-3 module.

Nobody has a practical attack that uses the structure of $x^{256}+1$. But it has a lot of structure: a Galois group of order 256, a full tower of subfields, and a ring that splits into many small CRT factors modulo 3329, which is exactly what makes the NTT fast. Every one of those is a lever that, historically, someone eventually tries to pull. We wanted a primitive that simply didn't have the levers.

So the goals, written on a whiteboard at the beginning of December, were:

  1. Smaller than 2,272 bytes on the wire at Category 3.
  2. Higher margins than ML-KEM-768 under the standard estimators (MATZOV and Chailloux–Loyer), not just under our own analysis.
  3. No cyclotomics, no subfield towers, no nontrivial automorphisms.
  4. ML-KEM speed, in Rust, with #![forbid(unsafe_code)] at the crate root and no assembly.

Any two of these are easy. Bigger keys buy security. Cyclotomics buy speed. Hand-written AVX-512 buys speed too. The problem is all four at once.

The graveyard

Tessera-1340

The first serious design was a Category 5+ Module-LWR scheme over $\mathbb{F}_{6991}[x]/(x^{67}-x-1)$. It was, in a narrow sense, beautiful: exact decryption failure rate of zero, 283 bits under MATZOV, and a clean dudect run with $|t| = 1.83$. It was also 3,784 bytes of public key and 3,912 bytes of ciphertext. And it was still a module scheme, which meant the rank-$k$ structure we were trying to get away from was sitting right there in the middle of it. We killed it.

PIKE-2D

Next we went sideways, to isogenies. PIKE-2D was a standalone KEM built on 2-dimensional isogenies in theta coordinates. On wire size it actually won: 1,078 + 1,028 = 2,106 bytes. On speed it lost by a factor that isn't a rounding error: 12.1 ms to encapsulate and 22.7 ms to decapsulate, around 600× slower than ML-KEM. There are places where 22 ms is fine. A TLS frontend at peak load is not one of them. Killed for general use.

The wildcard sprint

Having burned the two obvious directions, we spent a week on deliberately weird ones: twenty trapdoor ideas, each given a day to survive basic cryptanalysis. Sixteen died on contact. The best non-lattice survivor was what we called a hidden cyclic cellular-automaton recurrence: a public map $P = T \circ F \circ S$ over $\mathbb{F}_2^n$, where $S$ and $T$ are secret affine maps and $F$ is a cyclic CA with a local quadratic rule of window $w$. Ciphertexts were 64 bytes. That number is why it lasted as long as it did.

We did the work on it. We certified that there were no rank-0 or rank-2 polar forms by computing Pfaffians at $n = 16, 20, 24$, which closes off the usual differential and MinRank shortcuts against quadratic systems. Then we found the real problem: adjacent CA windows overlap in $w+1$ cells, and that overlap is preserved under the affine disguise. Between 62 and 64 rank-$w$ combinations of the public quadratics survived, at every size we tried. That's a MinRank foothold, and a structural one, not a parameter one.

Even without the foothold, the public key is a list of $n$ quadratic forms in $n$ variables, i.e. $n \cdot n(n+1)/2$ bits. At $n = 256$ that's 1.05 MB. At $n = 384$ it's 3.55 MB. 64-byte ciphertexts don't help you if the public key doesn't fit in an initial congestion window a thousand times over. Killed.

KUMMER-KEM-864

The last pre-breakthrough attempt went back to Module-LWE, but over a non-cyclotomic ring: $\mathbb{Z}_{4513}[x]/(x^{288}-2)$, with a mixed-radix 96-point CRT/NTT that ran in 0.39 ms in pure Python, which is not bad for Python. Then we listed what we had actually built. The ring decomposes into 96 linear CRT factors. $x^{288}-2$ generates a Kummer extension with a subfield $\mathbb{Q}(2^{1/d})$ for every one of the 18 divisors $d$ of 288. The sampler had a $2^{-43.34}$ abort probability that we'd have to justify forever. And the wire size was 2,768 bytes, 22% larger than ML-KEM-768. We had escaped cyclotomics by walking into a different tower. Killed.

The lesson from the graveyard was that structure keeps coming back as long as you're working with modules over a ring that splits. Getting rid of it meant leaving modules entirely.

The wire-size breakthrough

ML-KEM's bytes go to two places: the module structure (a public key is $k$ ring elements plus a seed, a ciphertext is $k+1$ compressed ring elements) and the modulus, which has to be large enough that one bit per coefficient survives the noise. Single-polynomial NTRU-LWR attacks both. The public key is one ring element. The ciphertext is one rounded ring element. There is no rank.

The catch is that NTRU-LWR rounds hard, and hard rounding means noisy decryption. So instead of fighting the noise with a bigger modulus, we spend it on an error-correcting code. The message is 24 blocks of the $[32, 11, 12]$ extended BCH code, 264 bits in total. Its weight enumerator is

$$\{\,0{:}\,1,\; 12{:}\,496,\; 16{:}\,1054,\; 20{:}\,496,\; 32{:}\,1\,\}, \qquad d_{\min} = 12,$$

so each block corrects five errors outright, and soft-decision decoding does considerably better. The first scheme in this family, TRIBCH-768, used $24 \times 32 = 768$ coefficients and hit 1,727 bytes, 24% below ML-KEM-768. It also used the ring $\mathbb{Z}_q[x]/\Phi_{2304}(x)$ with $\Phi_{2304}(x) = x^{768}-x^{384}+1$. Which is a cyclotomic. We'd won on wire size by giving up goal 3.

769 is prime

The fix came from staring at $24 \times 32 = 768$ and noticing that $768 + 1 = 769$ is prime.

NTRU Prime already taught everyone to use $x^p - x - 1$: prime degree, a large Galois group, and a modulus $q$ chosen so the polynomial stays irreducible mod $q$. The question we asked was what happens if you take $q = p$. The answer is Artin–Schreier: over $\mathbb{F}_p$, the polynomial $x^p - x - a$ is irreducible for every $a \neq 0$. No search, no luck. So

$$R_{769} \;=\; \mathbb{F}_{769}[x]/(x^{769}-x-1) \;\cong\; \mathbb{F}_{769^{769}}$$

is a field. Everything good follows from that line:

Goal 3, in four bullet points. Now we had to try to break it.

769 = 24 × 32 + 1     coefficient i  →  block (i mod 24), position ⌊i / 24⌋

  block   0    1    2    3   ...   23
  pos 0:  0    1    2    3   ...   23
  pos 1: 24   25   26   27   ...   47
  pos 2: 48   49  [50] [51]  ...  [71]    x⁸¹⁹ ≡ x⁵¹ + x⁵⁰  → blocks 3 & 2
  pos 3:[72]  73   74   75   ...   95     x⁸⁴⁰ ≡ x⁷² + x⁷¹  → blocks 0 & 23
   ...
  pos31:744  745  746  747   ...  767     coeff 768 unused (outside all blocks)
Figure 1. Strided placement of 24 $[32, 11, 12]$ BCH blocks across 769 coefficients. Reduction by $x^{769} = x + 1$ folds every high-degree term onto an adjacent pair $(i, i+1)$; because $i \not\equiv i+1 \pmod{24}$, a single fold never puts two correlated errors into the same codeword.

The layout in Figure 1 is not decoration. Reduction modulo $x^{769}-x-1$ sends $x^{769+k}$ to $x^{k+1} + x^{k}$, so the noise in coefficient $k$ is correlated with the noise in coefficient $k+1$. If those two coefficients sat in the same BCH block, one fold would spend two of that block's error budget at once. With stride-24 placement, they never do.

Red-teaming $p = q$

Taking $q = p$ is unusual, and unusual is where attacks live, so we spent longer trying to break this than designing it. The worry is obvious: the ring now has an automorphism it didn't have before. In $\mathbb{F}_{769}[x]/(x^{769}-x-1)$, Frobenius acts as $x \mapsto x^{769} = x + 1$. That's a translation, and it has order 769. $\mathrm{Aut}(K/\mathbb{Q})$ is trivial, but $\mathrm{Aut}(R_{769}/\mathbb{F}_{769})$ is not.

Three things save it.

Translation destroys shortness. $f(x) \mapsto f(x+1)$ is multiplication by the Pascal matrix mod 769. We built the full $769 \times 769$ matrix and pushed real secret keys through it. Short CBD vectors with squared norm around 380 come out with squared norm around $3.8 \times 10^{7}$, a factor of $10^5$. An automorphism that maps your short secret to a uniformly-looking element of the field isn't giving a lattice attack anything to work with.

The trace gives you nothing new. The Frobenius orbit sums to the field trace, which projects $R_{769}$ to $\mathbb{F}_{769}$. That exposes exactly one linear equation in the coefficients of $h$, and it's an equation anyone can already compute from the public key.

Rounding doesn't commute with Frobenius. The ciphertext is $\lfloor h r \rceil$ at modulus $Q_2$. Applying $\sigma$ to the ciphertext does not give you $\lfloor \sigma(h)\sigma(r) \rceil$; the rounding is coefficient-wise and the translation mixes every coefficient into every other one. There is no algebraic relation between the rounded objects to exploit.

At $Q_2 = 360$ the numbers are:

SchemePKCTTotalvs ML-KEM-768MATZOVChaLoy21
ML-KEM-7681,1841,0882,272—196.22155.74
Cobalt-7699228171,739−23.5%204.27164.00

Smaller and higher on both estimators. Goals 1, 2 and 3 at once. Which is the point where you should get suspicious of your own work.

Killing Assumption H

Every LWR scheme's failure-rate analysis leans on some version of the same heuristic: the rounding error behaves like independent uniform noise on an interval of width $Q/Q_2$. We had written it down in our notes as Assumption H, and our DFR for Cobalt-769 depended on it.

It's false. Not on average, but it doesn't have to be false on average to be a problem. Take $f = g = 1$. It passes keygen. It decrypts with zero error. And its deterministic rounding residue is $E = -Q_2 r$, which has variance

$$\mathrm{Var}(E) = 64{,}800 \;>\; \frac{769^2}{12} \approx 49{,}280,$$

the variance Assumption H says it should have. A real keygen won't sample $f = g = 1$, but that isn't the point. The point is that "the rounding error is uniform" is a statement about typical keys, not about the scheme, and a DFR bound that only holds for typical keys isn't a bound.

The fix is Cobalt-769D: add an independent uniform dither $d_i \in \{0, \dots, 768\}$ before rounding. The rounding residue becomes

$$D_i \;=\; d_i - \big((Q_2 u_i + d_i) \bmod Q\big),$$

and conditioned on $r$, each $D_i$ is a mean-zero random variable supported on two points exactly $Q$ apart, with the $D_i$ conditionally independent given $r$. Hoeffding's lemma gives each one a sub-Gaussian variance proxy of $Q^2/4$, and the tower property lifts the bound over $r$. Crucially, it holds for every key $(f, g)$ and every $r$. No distributional assumption about the key, no independence heuristic.

The dither costs noise, so we moved to $Q_2 = 600$, which costs wire: 922 + 888 = 1,810 bytes, still 20.3% below ML-KEM-768. To get a tight bound rather than a loose one, we wrote a refined integer Walsh–Hadamard evaluation that computes all 24,379,392 weight-12 signed quadratic forms directly, with a $(1 + 2^{-12})$ likelihood correction for the modulo sampler. Result: DFR $\le 2^{-142}$ with zero independence assumptions, and every one of the 24,379,392 entries verified bit-for-bit.

We ship both. Cobalt-769 is the smaller one with an estimated DFR in the usual style; Cobalt-769D is the one with a proof.

Level 1 died, Level 5 didn't

The construction wants $p - 1$ to factor as (number of blocks) × (block length). For Category 1 that pointed at $577 = 24 \times 24 + 1$ and the $[24, 12, 8]$ extended Golay code. Cobalt-577 died because $d_{\min} = 8$ isn't enough: to make the failure rate work it needed $Q_2 = 384$, which shrinks the rounding noise far enough that the security argument stops being interesting. Golay is a wonderful code. It's just the wrong one here.

Category 5 went the other way. Cobalt-1033 uses $Q = 1033$ (prime, so Artin–Schreier still applies), $Q_2 = 448$, and 32 blocks of the same $[32, 11, 12]$ BCH code for a 352-bit message. Multiplication goes through a 4,096-point NTT mod 998244353. It comes out at 2,431 bytes, 22.5% below ML-KEM-1024's 3,136, with 269.14 bits under MATZOV, 224.36 under Chailloux–Loyer, and a median DFR of $2^{-209.1}$.

ML-KEM-768
2,272 B
Cobalt-769
1,739 B (−23.5%)
Cobalt-769D
1,810 B (−20.3%)
ML-KEM-1024
3,136 B
Cobalt-1033
2,431 B (−22.5%)
Figure 2. Wire size per key exchange (dark = public key, light = ciphertext), scaled to ML-KEM-1024 (3,136 B).

215 µs to 17.9 µs, without unsafe

The first end-to-end Rust implementation took 215 µs to encapsulate and 274 µs to decapsulate. That's about 13× off ML-KEM, which meant goal 4 was the one actually at risk. The profile of decapsulation was unambiguous: 155 µs unpacking the radix-encoded public key and ciphertext, 63 µs decoding BCH, 19 µs in polynomial multiplication. Everything else was noise.

Initial Rust
215 / 274 µs
WHT + Limbs
37.8 / 41.5 µs (6×)
CRT NTT + Tree
17.9 / 20.6 µs (12×)
Radix unpack
155 → 5.45 µs (28×)
BCH decode (WHT)
63 → 4.1 µs (15×)
Dual-16b CRT NTT
19.0 → 4.5 µs (4.2×)
Keccak-f[1600]
493 → 221 ns (2.2×)
Figure 3. Top: end-to-end Cobalt-769 encaps / decaps latency on AMD EPYC 9B45 (native). Bottom: each hotspot after optimization as a fraction of its initial time.

Radix unpack: 155 → 5.45 µs

922 bytes for 769 coefficients is $\lceil 769 \log_2 769 / 8 \rceil$: the public key is a single big integer in base 769. That's what makes the encoding exact, and it's also what made it slow. The naive decoder peels off one coefficient at a time by dividing a 7,400-bit integer by 769, which is quadratic. The replacement is a 5-level remainder tree: precompute $769^{k}$ for the split points, divide the big number into a high and low half at each level, and recurse. Each level is a handful of multiplications by precomputed reciprocals, and the leaves are small enough to handle with a single Barrett step. Quadratic became quasi-linear, and 155 µs became 5.45.

BCH decoding: 63 → 4.1 µs

Because $[32, 11, 12]$ extended BCH is a linear code of dimension 11, every codeword bit is $c_j(m) = \langle m, G_j \rangle$ over $\mathbb{F}_2$, so $(-1)^{c_j(m)}$ is the Walsh character of the public column label $G_j \in [0, 2048)$. Accumulating the 32 soft torus costs into a length-2048 array at those 32 public labels and running one length-2048 Walsh–Hadamard transform scores all 2,048 codewords simultaneously. The original decoder computed the $32 \times 2048$ matrix-vector product directly; the WHT version runs on i16 lanes in 64×32 passes with zero secret-indexed lookups, which LLVM auto-vectorizes cleanly.

Multiplication: 19.0 → 4.5 µs

$R_{769}$ being a field is great for security and useless for the NTT: there's no ring splitting to exploit. So we compute the integer product of two degree-768 polynomials (a length-1,537 convolution) with power-of-two NTTs modulo two 16-bit primes, $12289$ and $18433$, both $\equiv 1 \pmod{2048}$. CRT recombines them, and the final reduction is $x^{769} \mapsto x + 1$ followed by reduction mod 769. One operand is always short, so the combined modulus of about $2.27 \times 10^8$ has enough headroom for the true integer coefficients. Two 16-bit NTTs beat one 32-bit NTT because 16-bit lanes give you twice as many per vector register, and Montgomery/Barrett reduction on 16-bit values maps onto vpmulhw-style instructions that LLVM finds on its own.

Keccak: one line of Cargo.toml

After all of that, the profile had a new top entry, and it was SHA-3. Keccak-f[1600] was taking 493 ns per permutation with target-cpu=native, which is roughly twice what a scalar implementation should cost. Reading the disassembly showed why: at opt-level = 3, LLVM's SLP vectorizer was packing Keccak lanes into AVX-512 registers and spending more on shuffles than it saved on XORs. Keccak's theta and rho steps are exactly the access pattern SLP vectorization handles badly. The fix:

[profile.release.package.keccak]
opt-level = 2   # SLP vectorizer regression on AVX-512 at O3: 493 -> 221 ns/perm

221 ns per permutation. If you ship Rust that hashes and you build with target-cpu=native on Zen 5 or Sapphire Rapids, go benchmark your Keccak.

The numbers

SuiteNative encaps / decapsPortable encaps / decaps
Cobalt-76917.9 / 20.6 µs53.4 / 76.3 µs
Cobalt-769D24.2 / 27.5 µs60.9 / 84.7 µs
Cobalt-103364.0 / 79.1 µs96.8 / 128.4 µs
Python SDK (Cobalt-769)24.4 µs—
ML-KEM-768, AVX2 (reference point)~15–20 µs

Cobalt-769 native is in ML-KEM's range, with zero lines of unsafe and zero lines of assembly. The portable build is 3–4× slower, which is what you get when the compiler isn't allowed to assume AVX2.

The pre-launch audit

We spent the last stretch before launch trying to find our own bugs before anyone else did. These are the ones worth talking about.

Encaps accepted $h = 0$

An all-zero public key passed every check in encaps(). With $h = 0$, the product $hr$ is zero, the ciphertext is just the encoded message, and the "shared secret" goes over the wire in the clear. A malicious or broken peer could make you do this. encaps() now rejects degenerate public keys before touching randomness. This one is embarrassing, and it's the kind of check that every KEM implementation should have and many don't.

KyberSlash-class division

KyberSlash taught everyone that x / q on secret data is a timing leak, because hardware div is variable-latency on most x86 parts. Our arithmetic used Barrett reduction everywhere, or so we thought. Then we built at opt-level = "z", where LLVM is optimizing for size and is happy to emit div instead of a multiply-shift sequence, and counted:

$ objdump -d --no-show-raw-insn target/release-z/libcobalt769.so | grep -cE '\s(i?div)\s'
26

Twenty-six. Most were in our code where we'd written % on a value we assumed the compiler would strength-reduce. One was inside the sha3 crate's block-count calculation. We replaced every % on secret-dependent data with an explicit Barrett multiply-shift in arith.rs, replaced sha3 with our own self-wiping sponge over keccak::f1600 in hash.rs, and rewrote the inversion as a subtle::Choice-driven divstep. The core of the reduction:

// arith.rs — no hardware division, at any opt-level.
//
// For x < 2^32: M = floor(2^32 / 769) = 5_585_133, and 2^32 - 769*M = 19.
// q = (x*M) >> 32 underestimates floor(x/769) by at most 1, because the
// truncation error x*19 / (769 * 2^32) is < 19/769 < 1. So r = x - q*769
// lands in [0, 2*769) and one masked subtraction finishes the job.
const Q: u32 = 769;
const M: u64 = 5_585_133;

#[inline(always)]
pub fn reduce(x: u32) -> u16 {
    let q = ((x as u64 * M) >> 32) as u32;
    let r = x - q * Q;                                    // r in [0, 2Q)
    let lt = ((r.wrapping_sub(Q) as i32) >> 31) as u32;   // all-ones iff r < Q
    r.wrapping_sub(Q & !lt) as u16
}

And because "we checked once" isn't a policy, tools/check_no_div.sh builds the crate at every optimization level we support and fails CI if a single division instruction appears:

$ RUSTFLAGS="" bash cobalt769-rs/tools/check_no_div.sh z s 2 3
opt-level=z libcobalt769.rlib: no div/idiv
opt-level=s libcobalt769.rlib: no div/idiv
opt-level=2 libcobalt769.rlib: no div/idiv
opt-level=3 libcobalt769.rlib: no div/idiv
# 0 hardware divisions in libcobalt769.rlib, cobalt769, bench, and dudect

The smaller ones

A radix round-trip test computed 1u8 << (round % 9), which overflows when round % 9 == 8. Release builds masked the shift and the test passed; debug builds panicked. Only the test was wrong, but it's a reminder to run the suite in both profiles.

The CLI used to read the entire input file into RAM before encrypting it, which is fine until someone hands it a 40 GB disk image. It now streams in 64 KiB chunks under AES-256-GCM-SIV, with a COBALT2\0 format header, about 10 MiB of resident memory regardless of file size, and 547 MB/s throughput.

Final verification

69/69 Rust tests pass in both debug and release. 12/12 known-answer tests match byte for byte. Then we built a C harness against the static library with -fsanitize=address,undefined and let it run:

$ cc -O2 -fsanitize=address,undefined stress_100k_asan.c -lcobalt769_ffi && ./a.out
[PASS] Cobalt-769   : 50000/50000 roundtrips (0 failures), 2500 tamper checks, 3,336 fuzz inputs
[PASS] Cobalt-769D  : 25000/25000 roundtrips (0 failures),   50 tamper checks, 3,336 fuzz inputs
[PASS] Cobalt-1033  : 25000/25000 roundtrips (0 failures), 1250 tamper checks, 3,336 fuzz inputs
ALL 100,000 ROUNDTRIPS + 10,008 FUZZ INPUTS PASSED UNDER ASAN+UBSAN!

And dudect on decapsulation, where the usual threshold for "this leaks" is $|t| > 4.5$:

$ for s in 769 769d 1033; do taskset -c 12 target/release/dudect --suite "$s"; done
valid=10000 invalid=10000 valid_mean_ns=20533.3 invalid_mean_ns=20542.2 |t|=0.445 PASS
valid=10000 invalid=10000 valid_mean_ns=27693.9 invalid_mean_ns=27713.5 |t|=0.888 PASS
valid=10000 invalid=10000 valid_mean_ns=79659.0 invalid_mean_ns=79505.4 |t|=1.623 PASS

dudect can't prove the absence of a timing leak. It can catch the presence of a big one, and it didn't.

What we're not claiming

ML-KEM has had a decade of public cryptanalysis by some of the best people in the field. Cobalt-769 has had weeks, most of them ours. The estimator numbers are better, but estimators measure known attacks against generic lattices, and the entire interesting question about Cobalt is whether $q = p$ Artin–Schreier rings enable an attack that generic lattices don't. We've tried hard to find one: the Frobenius analysis, the trace, the rounding argument. That is not the same as the world trying.

Break it

The specific claim is: NTRU-LWR over $\mathbb{F}_p[x]/(x^p - x - 1)$ with $q = p$ is as hard as the estimators say it is. The ring is a field; the only nontrivial automorphisms are powers of $x \mapsto x+1$; we think translation, trace and rounding together leave nothing to exploit. If we're wrong, the most likely place is something about $q = p$ that we haven't thought of, and we'd rather find out now than in five years.

Everything is at github.com/chai1any/cobalt769: the spec, the parameter scripts, the full 24,379,392-entry DFR table for Cobalt-769D, the KATs, and the Rust implementation. Attacks, partial attacks, and "this proof step is wrong" all go to chaitanya@chony.si. We will credit you publicly, and if you break it, we'll write the post about that too.