Blockchain data has to be sealed so it cannot be changed later. For a specific input, a hash function can only produce one unique output. If anything changes in the input, the hash function produces a completely different output.
Hashing is used to ensure the security and immutability of blockchain data:
- Step 1: A hashing function is run by inputting the blockchain data to get a specific output. This output is recorded as a seal for the data.
- Step 2: At any given instance, another hashing function can be run inputting the same data as step 1.
- Step 3: The output of the hashing function in steps 1 and 2 are compared. If there are any differences, this means the seal created in step 1 has been broken and the blockchain data has been changed.
Therefore, if someone wanted to change the blockchain data or double-spend a transaction, they would have to change the hash in all previous blocks. As the network grows, changing hashes across all the previous blocks becomes practically impossible.
Summary: a hashing function produces a unique output that can be used as a seal, is resource-intensive so it is difficult for a bad actor to take over the network, and is used to make blockchain data tamper-proof.
