The Case of the Mystery Seeds · Chapter 3
Why curves need seeds
A curve is just a handful of numbers. Somebody has to pick them, and the whole world has to trust that the somebody didn't pick a bad one on purpose. This chapter is about how you prove you had nothing up your sleeve.
Nib says: Words with a dotted gold underline are in my glossary; tap one to see what it means. The big toy in this chapter takes the real seeds NIST published and blends them into the real curves, in your browser. No trust required.
Not every curve is safe
In Chapter 2, walking backward on a curve was hopeless. That's true for most curves, but mathematicians have found a few special kinds where it isn't. Three examples, in plain words:
Curves whose point count breaks into small pieces. If the number of points can be split into small factors, the backward walk can be split into small walks, each easy. That's why good curves, like P-256, have a prime number of points.
Curves that can be moved onto a clock. For certain curves, a 1993 technique by Menezes, Okamoto and Vanstone translates the curve problem into the ordinary clock problem from Chapter 1, where better attacks exist.
Curves with exactly p points. Around 1998 and 1999, several researchers showed that on these "anomalous" curves the backward walk becomes fast.
Designers check new curves for all the known weak kinds. The nagging worry is the unknown kinds. What if a designer knew about a weakness nobody else did, and quietly chose a curve that had it? That kind of planted flaw is called a backdoor.
Nothing up my sleeve
Cryptographers have an old habit for this. When a design needs some random-looking constants, they make them in a way anyone can check, from something boring and obvious. These are called nothing-up-my-sleeve numbers, after the magician's patter.
A famous example is SHA-256, the hash function used by much of the internet today. Its 64 round constants are just the fractional parts of the cube roots of the first 64 prime numbers, written in hex. Check a few yourself:
Where SHA-256's constants come from
Pick one of the first eight primes. We take its cube root, keep the part after the decimal point, scale it to 32 bits and write it in hex.
Nobody could have tuned those numbers to hide something, because anyone can recompute them. Elliptic curves needed the same reassurance, and the ANSI X9.62 standard of the late 1990s offered a recipe for it.
A digital blender
The recipe uses a hash function. Think of it as a blender for data: put in any text or bytes and out comes a fixed-size, scrambled fingerprint. The same input always gives the same output. But change one letter and the output changes completely, and there's no practical way to find an input that blends into an output you picked in advance. The hash used for the NIST curves is called SHA-1, and its fingerprints are 160 bits long.
Try the blender
Type anything. Each square is one of the 40 hex digits of the SHA-1 fingerprint; gold squares changed since your last keystroke.
The recipe for a "verifiably random" curve
Here is how the NIST prime curves were made, following X9.62. The clock size p was chosen for speed and a was fixed at −3, also for speed. Only b was left to chance:
Pick a 20-byte seed.
Blend it with SHA-1. For bigger curves, also blend the seed plus 1, plus 2 and so on, and glue the fingerprints together until there are enough bits. Call the result c.
Find a b with b² × c = −27 on the clock. That rule ties the curve's basic shape to the hash. (With a = −3, it says c equals a³ ÷ b², a ratio that fixes the shape.) If no such b exists, or the finished curve fails the safety checks, throw the seed away and try another.
Publish the seed, so anyone can repeat steps 2 and 3 and get the same curve.
Because the blender can't be steered, the designer couldn't have picked b directly. Curves made this way are called verifiably random. Don't take my word for it that NIST followed the recipe. Check:
Blend the seed, get the curve
Choose a curve. We run its published seed through SHA-1 exactly as X9.62 says, then check the rule b² × c = −27 against its published b.
Published seed
Press Blend it.
Every one of the five checks out. The published curves really did come from the published seeds, and changing a single digit of a seed breaks the match completely. The recipe works.
The catch: seed shopping
Here's the loophole. The recipe proves the curve came from the seed. It says nothing about where the seed came from. A designer who could pick seeds freely could blend millions of them, privately test each resulting curve for a secret weakness, and publish whichever seed gave the curve they wanted. The output would still look perfectly "verifiably random".
To show how cheap this is, the toy below shops for a seed whose fingerprint starts with a pattern of your choosing. Each extra hex digit you demand makes the search about 16 times longer.
Go seed shopping
We blend "seed 1", "seed 2", "seed 3" and so on until a fingerprint starts with the pattern you pick.
Pick a pattern and press Shop.
A weak-curve property is like a pattern you're shopping for. If a fraction 1 in 220 of curves had some secret flaw, a designer would need about a million tries to land one. That's an afternoon's work, even in 1997. Some researchers have made the point vividly by publishing joke curves, produced by this very process, whose numbers spell out words like "BADA55".
So the honest answer to "can we trust these curves?" became: it depends on how much freedom the designer had when choosing the seeds. If the seeds were truly the output of some simple, fixed process, there was no room to shop. If they were picked from an unlimited supply, there was. And for the NIST curves, nobody knew which. That's the mystery.
Words in this chapter
Tap any word with a dotted gold underline to see what it means. Here they all are in one place.
Three things to keep
- 1
Some curves are weak. The known weak kinds are easy to avoid; the fear is a weakness only the designer knows about.
- 2
Hashing a published seed shows the curve wasn't hand-picked. Anyone can blend the NIST seeds and get the NIST curves; we just did.
- 3
But a freely chosen seed can be shopped for. The real question is how much freedom went into choosing the seed.
Check yourself
Why can't a designer just pick the b they want and then find a seed that blends into it?
Because a hash function can't be run backward. Finding a seed that produces a particular chosen output is practically impossible, so the designer has to take whatever b each seed gives.
If changing one digit of the seed completely changes the curve, why isn't that enough to prove the curve is safe?
It proves the curve came from that exact seed. It doesn't prove the seed wasn't chosen out of millions of tries because its curve had a property the designer wanted.
Which would make you trust a seed more: "it's 20 bytes of random-looking hex" or "it's the hash of the word 'curve' plus the number 1"?
The second. A simple, explainable origin leaves almost no room for shopping. Random-looking bytes with no story could have come from anywhere, which is exactly the problem with the NIST seeds.
Go deeper
- Paper · 2015 · Koblitz and Menezes
A Riddle Wrapped in an Enigma
Two founders of the field review the controversy over the NIST curves, and argue why seed shopping was an unlikely route to a backdoor.
Read on IACR ePrint ↗ - Next · Chapter 4
The mystery
The NSA's seeds, a forgotten joke, a famous backdoor, and a bounty.
On to Chapter 4