BTC#: Big Numbers Are Big

CryptographyBasicsTitle

Series: BTC# – Learning to Program Bitcoin in C#

« Previous: Modular Arithmetic

Next: Big Integers in C# »

Why We Use Big Numbers

The private keys we use to secure our funds or our communications are 256-bit numbers chosen at random and then kept secret. What happens if two people randomly choose the same number? Or if you guess someone else’s number?

That’s very bad. If you somehow get hold of someone else’s secret number, you have the keys to their funds.

How likely is that to happen?

Vastly hugely mindbogglingly unlikely.

How Big Are These Numbers?

A 256-bit key has 2256 possible values. Expanded into its decimal format that’s 1.15 x 1077. 115,​792,​089,​237,​316,​195,​423,​570,​985,​008,​687,​907,​853,​269,​984,​664,​640,​564,​039,​457,​584,​007,​913,​129,​639,​939. 115 quattuorvigintillion. A number so big you’ve never even heard the word before.

Roughly the number of atoms in the universe.

SpaceIsBigQuote.png

At the end of Chapter One of Applied Cryptography, Bruce Schneier provides a table of large numbers. He lists things like the odds of being killed by lightning (1 in 9 billion per day) and the odds of winning a state lottery (1 in 4 million), which we can compare to the odds of randomly selecting two identical 256-bit private keys.

The odds of getting killed by lightning the day you win the lottery are 1 in

9 x 109 x 4 x 106 = 3.6 x 1016

i.e. 1 in 36 million billion, 36 with 15 zeroes after it, which doesn’t even touch the sides of crypto-maths-sized numbers. We’re still gonna need some bigger numbers to multiply by if we want to get close.

Now imagine that instead of guessing the numbered balls that will tumble out of the Powerball machine that you have a much bigger machine tumbling the entire Sahara Desert and you have to guess which grain of sand will come out. There are 1.5 x 1024 grains of sand in the Sahara Desert, according to BBC Earth.

The odds of you winning this Sahara lottery, correctly guessing which grain of sand will pop out of the machine and simultaneously getting struck by lighting are 1 in.

9 x 109 x 1.5 x 1024 = 1.35 x 1034

If the Sahara lottery was just the qualifying round and to win you had to then do the same thing but pick the correct grain of sand from the Gobi desert the odds would be 1 in

9 x 109 x 1.5 x 1024 x 1 x 1023 = 1.35 x 1057

which is still only one hundred-quintillionth of 115 quattuorvigintillion but I’ll stop here because it’s getting silly.

RidiculousOdds.png

The chance of a random collision of 2 256-bit numbers is a hundred quintillion times lower than the odds of the ridiculous Sahara-lightning-lottery thing. It’s not gonna happen.

« Previous: Modular Arithmetic

Next: Big Integers in C# »

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s