Skip to the result

ResearchTechnical note 7

Learning the arithmetic of ChaCha20 and SipHash

ChaCha20 and SipHash are built to scramble data so thoroughly that their output looks random. From examples alone, METRON learned the exact laws of their building blocks, and the laws, put together, reproduce both algorithms bit for bit.

Measured
8 November 2026
Algorithms
ChaCha20, SipHash-2-4
Reference
RFC 8439 vectors
Record
§170

At a glance

128

output bits learned exactly in every building block of both algorithms.

1,024

ChaCha20 blocks reproduced exactly, and the published test vector matched.

64

official SipHash-2-4 test vectors reproduced.

In plain words

These two algorithms protect a large part of the internet’s traffic. Each mixes its input with additions, rotations and XORs until nothing recognisable is left. We showed METRON examples of the mixing and it worked out the exact rules, well enough to rebuild both algorithms.

For engineers

Add-rotate-XOR primitives: the ChaCha20 quarter-round and the SipRound, learned in parts from input and output samples and then composed. Checks: RFC 8439 §2.3.2 block vector, 1,024 random blocks, the 64 reference SipHash vectors, 1,024 random messages.

Why it matters

It is a hard, public, unforgiving benchmark: one wrong bit anywhere and the output is garbage. Passing it shows METRON handles the arithmetic that real processors and real protocols are made of, not toy functions.

MTRMETRON is AIDON’s exact co-processor. It learns laws from data, proves them and runs them, alongside a neural model or on its own.

The bottleneck

Mixing functions are where learning systems give up.

Add-rotate-XOR designs are chosen for cryptography because their output shows no simple pattern. They are among the hardest functions to learn from examples.

They are also everywhere: in every TLS connection, in hash tables, in checksums. A system that claims to learn machine arithmetic has to face them.

Result

Learned from examples. Identical to the standard.

Output bits learned exactly, out of 128

METRON128 / 128
Same data, no structure0 / 128
Scrambled control7 / 128

Fig. 1 One part of the ChaCha20 quarter-round. METRON learns every one of its 128 output bits exactly. Treated as a single black box, the same function yields none.

Table 1 The learned laws, composed, against the reference implementations.
MeasureValue
ChaCha20 parts learned, exact output bits128 of 128, in each part
SipHash-2-4 parts learned, exact output bits128 of 128, in each of four
ChaCha20 block against the published test vector (RFC 8439)Identical
ChaCha20 blocks, random inputs1,024 of 1,024
SipHash-2-4, official test vectors64 of 64
SipHash-2-4, random inputs1,024 of 1,024
Whole run18 min 11 s

This is learning a public algorithm from examples of its inputs and outputs. It is not cryptanalysis: no key is recovered and no cipher is weakened.

Method

How the algorithms were learned

  1. Examplesinputs and outputs of each building block
  2. METRONfinds the exact law of every output bit
  3. Compositionthe laws rebuild the whole algorithm
  1. Each building block is sampled. METRON sees inputs and outputs, never the source code.

  2. METRON learns one exact law per output bit.

  3. The laws are composed into the full algorithm and compared with the published standards.

Controls

What was checked

Published vectors

The composed ChaCha20 block equals the RFC 8439 test vector; SipHash-2-4 matches all 64 reference vectors.

Random inputs

1,024 random ChaCha20 blocks and 1,024 random SipHash messages, all identical to the reference.

Scrambled control

With the examples shuffled, only 7 of 128 bits come out, the trivial ones. There is nothing to learn in noise, and METRON learns nothing.

No structure

Given the same function as one undivided black box, 0 of 128 bits are learned. The result depends on METRON’s structure.

Open questions

What this opens

  • Other families of primitives used in processors and protocols.
  • Learning the structure itself, instead of receiving it.

Fields of application

Where it fits

  • Hardware implementations of standard algorithms, generated from behaviour and checked against the standard.
  • Verification: confirming that an implementation computes exactly what the standard says.
  • Processors for networking and storage, where these functions run billions of times a second.

Record

How this result is kept

Record
§170, measured
Run
8 November 2026, 18 min 11 s
Sample
6 building blocks; 1,024 blocks and 1,024 messages; official vectors
Measurement file
SHA-256 f480018e17ddae12d610c3a94133a6e313c2b2c1aec863ca6b7d872e0f14ee1c

Every figure on this page was read by a program from the raw measurement file, not typed. The fingerprint identifies that file: when it is disclosed, anyone can check that it is the same one.

Contact

Talk to the founders

Get in touch. We would be glad to share our ideas and walk you through the results, the proof and the measurements.