What is a hash function?

To fully understand the cryptocurrency blockchain we must take a brief interlude in understanding the mathematics behind it. The encryption process taking place requires a programming concept called a hash function. In explaining the hash function I’ll try to do my best to minimise any mathematical terminology.

Generally, a hash function takes any random pieces of input data (called a key) and converts them using a logical process into a code with a fixed length. Importantly, the hash output, better known as the value, cannot be back-solved into the original input data. Similarly, in cryptocurrency the hash function is the part of the programming that converts a number of transactions into a seemingly arbitrary code.

The function uses the previous hash value as a starting point for calculating the next hash function. As such the process links each hash to the previous one thereby creating a chain of transactions better known as the blockchain.

hash function

What does the hash value look like?

The crypto-mining process attempts to offer solutions to the hash function with the correct attempt (once confirmed by other machines) being rewarded.

The hash value is a long string of seemingly random letters and numbers and can vary in length depending on the hash rate. Crucially, with an increased number of people attempting to solve the function, the solution becomes more complicated. As such increased difficulty means a higher hash rate. As such, the hash output is more complex and would therefore take longer to find.

To give you a better idea as to what the hash output may look like for Bitcoin:


Clearly, the hash value seems to be a random set of letters and numbers. As such, it near impossible to use the hash to be able to calculate the exact transactions.

Whilst the series of letters and numbers looks long and complicated, it is representing a vastly larger series of transactions.

Cryptographic hash function characteristics

  • Quick

The hash function should be quick to convert the transaction data into the hash value.

  • Uncorrelated

With each new transaction the hash function should convert the previous hash value sufficiently such that it is unrecognisable from the previous hash value.

  • Non-solvable

There should be no way to back solve the original data from the hash value. The only possible means should be to try all combinations of transactions and thereby check if they create the same hash value.

  • Deterministic

The hash function is deterministic. Therefore regardless of the miner, the same set of transactions will produce the same hash value. This is critical in order for transaction confirmation process.

  • Individual

Finally, each hash should be individual. The hash function should work in such a way that there should be no two or more sets of transaction data that produces the same hash value.

Leave a Reply

Your email address will not be published. Required fields are marked *