Behind Blockchain Encryption – The Sha 256 Hashing Algorithm
What is the Sha 256 Hashing Algorithm?
The Bitcoin blockchain is essentially a series of blocks with transactions, sender/receiver information, time stamps and an encrypted key that seals each block. The Sha-256 hashing algorithm works by comparing a computed hash, to an expected hash value. This value is decided by the bitcoin network.When the SHA-256 algorithm has been solved, it produces a string of 256, seemingly random characters, or a hash. A hash is a digital fingerprint of the inputed data, meaning that although it represents the data, it is very difficult to guess the inputted data from the hash alone.
This mathematical problem in-a-box is known as a proof of work calculation. These proof of work calculations are often carried out by stacks of GPU’s, or ASIC’s. Whilst CPU’s used to be the norm, eventually too many computers joined the bitcoin networks. As mining became more popular, the difficulty of solving blocks increased (see: scaling). As the difficulty increases, greater amounts of attempts per second were necessary to solve blocks, and GPU’s were found to do this far more capably than CPU’s. When building a miner, your GPU’s will generally need to be of a good standard but your CPU… less so.
Computers on the blockchain network are competing to solve the block, by guessing the correct hash signature. This signature can only be guessed by brute force. A brute force calculation is a task that involves trying all possible combinations, one by one. Solving this ‘block’ by guessing the correct signature is the proof of work.
Bitcoin uses the Sha-256 hashing algorithm, but many different cryptocurrencies adopt different kinds of hash, or altogether different techniques. For example ByteBall, an alt coin that uses a directed acrylic graph or DAG instead of a block chain. Byteball transactions are confirmed on the main chain without any need for a proof of work to be solved. This eliminates the need for miners, making it more energy efficient.
Check out this quick instructional video from the Federalist Society youtube channel to find out more about how the hashing algorithm works in Bitcoin: