SHA256 - The world’s most popular algorithm.
What is the SHA256? The SHA256 algorithm is a one-way deterministic hash function that outputs 256 bits.
And what the fuck is that? Let me break it down for you.
An algorithm is simply a process. A list of steps for doing something.
A hash function is a mathematical function that takes any size input but has an output of a fixed size. Think of this as a digital fingerprint for a file.
It is deterministic meaning not random. The same input will always give the same output.
One way function simply means its hard to do backwards. Some functions are easy such as 10 + 20 = 30 you just take 20 away from 30. However, the multiplication of two big numbers is a lot harder.
SHA 256 takes any kind of digital input (music, picture, text) and any length of that input but will always output 256 bits. What do I mean by bits? Simply 256 ones and zeros that make up a large number usually written out in hexadecimal. The reason this algorithm is useful is because the only time you will end up with the same hash or fingerprint is if you started with the identical input. There are so many different possible fingerprints that no two inputs have ever ended up with the same fingerprint.
So how many hashes are there?
Another amazing propriety of this function is that it is designed to have the butterfly effect built in such that changing the input even just a microscopical amount will completely change the output. Confusing right? Ok so as an example lets take a picture 1000 x 1000 pixels large (1,000,000 pixels), at 3 bytes per pixel (red, green, and blue) + 56-byte header that is 24,000,448 bits. When I run this image through the SHA256 algorithm I get a hash if I change just 1 bit out of the 24 million I get a completely new hash. This is very useful in cryptography, digital signatures, authentication, and BITCOIN.
We know that no one can reverse this function as there are billions upon billions of $ stake. SHA256 is a key part of the bitcoin protocol. If you could reverse the algorithm you could mine bitcoins faster than anyone else and make billions.
But how does this work? Let me tell you, to mine BTC all you must do is find an input that produces a SHA256 output with 70 zeros at the beginning. Since there is no known formula the way you solve is by brute force. I said above finding an exact match is impossible however BTC mining does not require you to find a match only one that is close.
In the race to mine BTC special computers have been built just for running SHA 256 as fast as possible. How fast? Well, if you add up all the bitcoin miners hash rate they are currently doing 5,184,000,000,000,000,000,000,000 hashes a day.
There is a massive financial incentive to figure out how to reverse the SHA256, who will be first? Or many someone has and does not want to kill the golden chicken. Or maybe there is a secret government agency behind it all. I mean who developed the SHA256….. oh wait…… the NSA.