Blog · Security
Finished and numbered
Most of the cryptography that keeps people safe is a bet that some problem is hard to compute. A small part makes no bet at all: its guarantee is an exact count, settled once, that no computer can change. Two lines of scripture describe that kind of guarantee. Here is which part of IRL rests on it, why it holds even if P = NP or against a quantum computer, and every link in the chain that isn’t a count.
The reading
Tetelestai is the word in John 19:30, “It is finished.” The Greek is a perfect tense: something completed in the past whose result still stands. Luke 12:7 says:
But even the very hairs of your head are all numbered.
That is knowledge that is exact and leaves nothing out. Read together as a claim about security, the two lines describe a guarantee that is an exact count of every case: finished, and unchanged by any amount of computing. Cryptographers call that kind of guarantee information-theoretic. C. E. Shannon showed in 1949 that the one-time pad has one. We named the parts of IRL that have one after the first line: Tetelestai.
Two kinds of guarantee
- Hardness. “No program that runs in a reasonable time can break this.” It rests on a guess that some particular problem is hard to solve, nearly every time, which asks more than P ≠ NP. If P = NP, all of it fails, and it can fail even if P ≠ NP.
- Counting. “Every possible attacker, however much computing it has, wins with chance at most this count over that count.” It is proved by counting the cases, and it assumes no problem is hard. P vs NP asks how fast an answer can be found. A count doesn’t depend on speed, so the answer can’t change it, and a quantum computer can’t either.
“Unchanged by any amount of computing” is only true if every link in the chain is a count. One hardness link anywhere makes it false for that link. So we went through the chain one link at a time.
What the guarantee is
Tetelestai has two jobs. Both are for phones talking over the mesh with no internet, which is still a design, and neither is in the web app:
- A one-time key book. Two people fill it in person. Each statement carries a tag. Tags are made in GF(2128), the field GCM uses (x128 + x7 + x2 + x + 1). Someone who has seen a statement and its tag forges a different one with chance at most L/2128 a try, where L is the statement’s 16-byte blocks plus one. Each failure rules out keys, so later tries do very slightly better; what holds is the total, at most q·L/2128 over q tries. A key takes at most 16 failed tries, so at most 16·L/2128 a key. In version 2, where one hash key serves a whole book, a side takes at most 216 failed tries in all, so at most 216·L/2128 over the book’s life: about 1.3 × 10−32 for 1 KB statements.
- Recovery shares. A secret split into n shares, any k of which put it back; the person splitting chooses k and n, with 2 ≤ k ≤ n ≤ 255. The shares are bytes in GF(28), the field x8 + x4 + x3 + x + 1 that AES uses. Fewer than k shares say nothing about the secret: every secret fits them equally. Before splitting, the secret gets a check in GF(2128), so a share someone changed is caught except with chance at most (d + 1)/2128, where d is the number of 16-byte blocks the secret and its one length byte fill, rounded up to an odd number: 3 for a 256-bit secret, so 2−126.
The chain, link by link
| Link | What it says | Kind | Checked by |
|---|---|---|---|
| The forgery bound | a forged tag fits at most L of the 2128 keys | count | Lean |
| The pad | exactly one pad takes any hash to any tag, so a tag says nothing about the key | count | Lean |
| The field | the 2128 values the tag is made of form a field (GCM’s polynomial is irreducible) | count | Lean, 64 gcds the kernel computes |
| Tamper detection | a change to a share passes for at most d + 1 values of a random x | count | Lean |
| Threshold secrecy | k − 1 shares fit every secret equally, over the field the library really uses | count | Lean, and a test of all 65,536 byte pairs |
| Mixing sources | one truly random source, mixed with any others it’s independent of, gives uniform bytes | count | Lean |
| Dice | fair dice give uniform bits | count | Lean |
| Code to model | the JavaScript computes what the theorems are about | tests | test vectors, and proved twins run beside the code |
| Random | keys and pads come from a truly random source: hardware noise, or dice | physics | not a proof |
| Used once | no key or pad is ever used twice | software | not a proof |
| The book between phones | carried in person, held by code installed before anything breaks | procedure | not a proof |
Every mathematical link is a count, so it holds against unlimited computing. One link is tests. No proof establishes the physics or the procedure. Dice are beyond computing. “Used once” is kept by software, and software can be attacked.
Where hardness would come in
- The phone’s own random number generator, alone. It stretches a little hardware noise with a hardness assumption. So the book is filled from a physical source mixed in, and one truly random source is enough, as long as it’s independent of the others.
- A book or the code sent over the internet. Both would rest on key exchange and signatures. Books move only in person, and only code already on the phone holds them.
- What a recovered secret protects. If it is a key for a cipher, that use rests on hardness. The split keeps the key perfectly, not what the key protects.
One more hardness link sits outside the guarantee: the Bitcoin timestamp on our proof record rests on SHA-256. It dates the record. It isn’t part of what the record proves.
Against a quantum computer
- Shor’s algorithm (1994) breaks RSA, elliptic curves and Diffie–Hellman. Tetelestai’s guarantee uses none of them.
- Grover’s algorithm (1996) searches a space of N possibilities in about √N steps, but only if each guess can be tested. Here nothing can be tested: every tag is masked by a pad used once, so every one of the 2128 keys fits what an attacker has seen equally well, and fewer than k shares fit every secret equally. With no test to run, Grover finds nothing. The bound stays L/2128 a try, not its square root.
- Any attacker who sees ordinary tags and shares, however it computes, ends up making a guess. The count bounds every guess.
Two limits. That last step is a standard argument, but our Lean theorems are classical counts and don’t formalise it. And there is a model the proof doesn’t cover: an attacker who can make the device compute tags on a quantum superposition of messages. Boneh and Zhandry (2013) showed what a one-time MAC needs there, four-wise independence, and ours, with only 256 bits of key, doesn’t have it. A phone answering radio messages computes on ordinary bytes, not on quantum states, so that model doesn’t describe it.
Quantum computers do reach the links around the guarantee, the hardness links listed above: anything carried over the internet rests on today’s signatures, which Shor threatens; a recovered AES-256 key keeps about 128 bits of security against Grover, while a recovered signing key falls to Shor; and the Bitcoin timestamp’s SHA-256 loses some margin to Grover but only dates the record.
A likelier break than P = NP: timing
The JavaScript that made and checked tags multiplied in GF(2128) with BigInt, which doesn’t run in constant time: how long a multiplication takes depends on the numbers in it. In version 1 that matters little, because each key is used once. In version 2 one hash key serves a whole book, and checking a forged statement multiplies the forger’s chosen blocks by that key, up to 216 times a side. Someone who could time those checks closely enough could learn the key, and with it change a statement on its way. Our own notes said timing reveals nothing that will be used again. For version 2 that was wrong.
So we changed it. The JavaScript now makes and checks tags with no BigInt: the field as four 32-bit words, 128 steps for every multiplication, masks instead of branches, and no branch or memory access that depends on the key. Tests hold it to the old code on 20,000 random products and on tags at every block edge, and time it: an all-ones key takes as long as a one-bit key, where the old multiply took about 140 times as long. Planting a branch on the key, or work that grows with the key’s bits, fails those tests. It’s also about 16 times faster.
What that doesn’t promise: JavaScript runs under a just-in-time compiler and a garbage collector, so it can’t guarantee constant time the way compiled code can. The SPARK version of the MAC is the same design, compiled. Nothing uses Tetelestai today: it isn’t in the web app, and the phone it’s for isn’t built.
Two caveats
- Certainty is only as good as the count and the checker. These counts are theorems about every case, not tests of some cases. Lean’s kernel checks them, and six external checker runs replay all 58,850 declarations the proofs rest on, four of them by checkers that are not Lean’s kernel. 928 of those declarations are IRL’s own, 661 of them theorems (counting the lemmas Lean generates for them); the rest are Lean’s core library. So the place to attack is the statements and the checkers, not computing power. The proofs don’t rest on trust: any kernel can replay them. Whether the statements say what we claim rests on readers, not checkers: checkers can all accept a proof of a statement that doesn’t say what we meant. The library’s statements have been read once, by the same work that wrote the proofs, the least independent reading there is; readings by our founder and by someone outside are still to come. The open problems’ statements carry guards and are read twice, the second time by a reader apart from the work that wrote them, and four of them, IRL-008 to IRL-011, were also written again by a reader who hadn’t seen ours and proved from our solutions. Nobody outside has replayed the proofs yet.
- The guarantee covers the model, not the world. The theorems are about Lean’s model of the code. That the JavaScript computes the model rests on tests, not a proof. A pad used twice is broken however finished its proof is. The proofs don’t cover timing (above).
Since 28 November
- Thirteen open problems, eleven judged. The register of security mathematics not yet proved now numbers thirteen. Eleven are solved, read twice and judged in a sandbox by six checkers. Three of them carry this post’s guarantee further: the key book never spends a byte twice (IRL-009); many tags under fresh pads say nothing about the hash key (IRL-011); and with version 2’s hash key reused after failed tries, the next try succeeds with chance at most its block count over the keys no failed try has ruled out (IRL-010). Two more are proved and wait for their second reading: recovery passes over a changed share (IRL-012), and a key book open in many tabs of one phone never sends a byte twice, provided one tab changes it at a time and its record is saved before a statement leaves (IRL-013). That rule is John Nash’s, from a 1954 RAND memo on computers with many control units: “only one is permitted at a time”. Drop either half and a byte can go out twice; the counterexamples are proved too.
- A second reading, and a gap closed in the code. The second reading of IRL-008 to IRL-011 found places where the words said more than the Lean. One was in the code: a tag could be checked across halves of two pads, a case the bound didn’t cover. No attack was found, and the code now looks at a statement only on its sender’s grid.
- Statements written twice. As the HOL Light formalization of the Poincaré conjecture checks its statements against an audit’s, a reader who hadn’t seen ours wrote IRL-008 to IRL-011 again from the words and the code, and each is proved from our solution.
- Checkers shown to say no. Every run, the judge must refuse three planted solutions (a different statement, an added axiom, a declaration the kernel never checked), and nanoda a planted proof by
native_decide; nanoda now accepts only the three standard axioms. Phrack 73’s “Owning the Truth” shows why it matters which checkers: it says lean4lean, a port of Lean’s kernel, inherits one of its bugs. Six runs guard against one checker’s bug, not a flaw they all share. - Quoted words can’t become a tag. From the same issue of Phrack: IRL’s moderation prompts quote people’s words so that no input can spell a tag or a model’s control token, proved in Lean for every input, with the model pinned to the code by the code’s own output.
What’s new and what isn’t
None of the mathematics is new. Pieces of the framing aren’t new either: complexity theory has been called “quantitative theology”, Nicholas of Cusa compared the mind reaching for truth to a polygon reaching for a circle, and theologians have long read the perfect tense of tetelestai as finished with lasting effect. We have not found tetelestai and Luke 12:7 read together as information-theoretic security anywhere else. Searches can’t establish that it’s new. If it is, it is a new way of presenting known mathematics, not new mathematics.
The paper and the record
The paper has the definitions, the full chain with each theorem’s name, and the references: Finished and numbered (PDF). The record of the last proof run, with every theorem and each checker’s verdict, is lean.json, timestamped in Bitcoin with OpenTimestamps (the proof). The proofs themselves are public, Apache-2.0: irl-formal on GitHub, with the Lean library, the open problems with their solutions and guards, the SPARK MAC and AMD check, and a script that checks every axiom and judges the solutions. Its README says how to replay it, and what a pass does and doesn’t mean. If you find a statement that doesn’t say what we claim, open an issue there. How the rules a bot must never get around are checked is in an earlier post.
Credits
The reading and the questions are our founder’s. The mathematics is older than IRL: C. E. Shannon on the one-time pad (1949), Adi Shamir on secret sharing (1979), Michael O. Rabin (1980) and Michael Ben-Or (1981) on testing a polynomial for irreducibility, Mark N. Wegman and J. Lawrence Carter on one-time authentication (1981), and Ronald Cramer, Yevgeniy Dodis, Serge Fehr, Carles Padró and Daniel Wichs on detecting tampering (2008). The method owes much to Alexander S. Donahue’s archive and repositories. The proofs, models and this post were written with AI coding assistance. The proofs don’t rest on trusting that: kernels and checkers check them. Whether the statements say what we claim, the randomness, the code, how it’s delivered and how keys are handled still need their own evidence. None of the people or projects named here has reviewed or endorsed this work.
If you find a mistake in the reading or the mathematics, write to [email protected].