In public-key cryptography, a hash value is used as a summary of the initial input number. A hashing algorithm is applied to the original input number to create that hash value. The point of a hash value is that it is theoretically impossible to find the original input number without knowing the hashing algorithm used to create the eventual hash.

Although it would be relatively easy to find that an input number of 12 and a hashing algorithm that simply multiplied the original number by 11 was used to create a hash value of 121, these kinds of solutions become increasingly difficult to find as you begin to use extremely large numbers. This is a simplification about how encryption works, but it’s a good way to look at things when learning about public-key cryptography for the first time.

The Point of Hashing Algorithms

For any hashing algorithm to be successful, it needs to be easy to create an output but impossible to find an input. In other words, the example above would not be good at all for encrypting sensitive data. Since you know that the hash value is 121 and the algorithm used was to multiple the input number by 11, it becomes easy to find that the original input number was 12. On the other hand, imagine if the input number could be a list of numbers that are added together before they’re multiplied by 11. This means that the input numbers could now be [12], [2,4,6], [3,3,3,3], or any other list of numbers that adds up to 12. With this hashing function, it becomes much more difficult to find the original input number when the hash algorithm and hash value are all you have.

Bitcoin’s Hashing Algorithm

Bitcoin uses SHA-256 as its cryptographic hash function, which was originally developed by the US National Security Agency. This hashing algorithm is used to make sure that the Bitcoin accounting books are in order. There is no central authority checking all of the transactions in Bitcoin, so a low-trust system for preventing double spends was created by Satoshi Nakamoto. This was Satoshi Nakamoto’s major technological achievement, and it’s what makes the Bitcoin blockchain, or decentralized ledger, possible. SHA-256 is used as a way for a miner to prove one’s worth to the network. A large amount of computing power is used to guess the valid hash related to each block of transactions. Once that valid hash is found, the miner then receives the block reward and transaction fees associated with that particular block.