How large is a 256-bit number, anyway?

0 1056
Avatar for kentropy
2 years ago

The Binary Representation of Numbers

Any arbitrary piece of data (audio, images, or video, for instance) can be represented as a binary number. A binary number is a collection of bits, each bit equal to 0 or 1. The bits can be thought of as "on" or "off", "yes" or "no".

A 256-bit number is simply a string of 256 bits. Almost any 256-bit number that you can write down, like...

1001000010100110100100011101000111101001101011111001110110101001
1110110100111011000011101111001101101111010000011010100111000100
0011111010110000010011100100001111010001100110110010111110011101
1000010001010000010001011101111011011111101111001011010110101010

is a unique Bitcoin private key. With this private key, you have complete control over the funds in some corresponding wallet.

In fact, 256-bit numbers are not just found in cryptocurrency, but are used ubiquitously on the internet, and form the basis of secure communication on the web. This could come as a surprise- 256 bits may not sound like a whole lot. Couldn't we just generate random keys until we come across a wallet with funds in it?

A 256-bit number is mindbogglingly large.

Let's compute the total number of unique 256-bit numbers. Since each bit can either be zero or one, we can represent 2^256 unique numbers. If we were to convert that into our base-10 number system:

>>> 2**256
115792089237316195423570985008687907853269984665640564039457584007913129639936

That's 10^77 - a number with 77 decimal places. Our best estimate of the number of atoms in the entire universe is 10^80. Therefore, there are only 1000 times more atoms than there are unique 256-bit numbers!

You may say: but we have some really fast computers! If enough hash power is thrown at it, couldn't we generate all possible private keys, steal funds, and destroy cryptocurrency? It's not so easy.

Suppose every BTC miner joined together, and their entire compute power were used to iterate through all 10^77 keys. The current total hashpower of Bitcoin is approximately 150 million terahashes per second, which is 1.5 * 10^18 hashes/second:

10^77 total keys / 10^18 (keys/second) = 10^59 seconds = 10^51 years

It would take 10^51 years to go through all of the keys. That is significantly larger than the age of the universe! The sun will burn out, the solar system will cease to exist, and we will still be here, computing hashes.

In Conclusion...

256-bit numbers can enable extremely secure encryption schemes. Faster computers are absolutely no threat to 256-bit encryption. We will never able to store or process this number of keys. There simply isn't enough energy or time in the universe to do it.

Image Credit: Douglas Crawford

1
$ 0.51
$ 0.51 from @TheRandomRewarder
Avatar for kentropy
2 years ago

Comments