Join 94,123 users already on

How large is a 256-bit number, anyway?

0 138 exc
Avatar for kentropy
Written by   3
1 year 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...


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

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

$ 0.51
$ 0.51 from @TheRandomRewarder
Avatar for kentropy
Written by   3
1 year ago
Enjoyed this article?  Earn Bitcoin Cash by sharing it! Explain
...and you will also help the author collect more tips.