Hashing may sound like a scary word, but it is super simple. Hashing is a function, or a series of steps that run on an input and give a result, an output.
I’m a visual learner, so let’s walk through an example.
Pick any square below:
Apply my “Grid Hash” function to it:
1. Move up 2 squares
2. Move right 1 square
3. Move up 1 square
4. Done! You just applied a hash function
(If the function takes you out of bounds, wrap to the other side. For example, a move to the right at 100 will take you to 91)
Note: Good hash functions have to be Consistent and “One Way”
Consistent: No matter how many times you run the “Grid Hash” function, if you pick the same input you will always land on the same square. If you land on a different square the hash function is not consistent.
One Way: The “Grid Hash” function is not a “One Way” function. I landed on 44. You can easily reverse the function to determine where I started. The ability for you to walk backwards makes “Grid Hash” a “Two way” function. A “One Way” function should be practically impossible to reverse.
The Bitcoin hashing function (SHA-256) is an excellent one way function and nearly impossible to reverse.
Look what it turned 44 into:
Another great property of a hash function is it’s easy to verify. If you do not believe that 44 is 71ee45.. You can use an online SHA-256 calculator here and see for yourself.
Now that we know what hashing is, we have enough information to know how blocks get added.