The magic of the blockchain lies in recording data, and linking it to a chain, making the individual transactions linked and unchangeable within the chain. The cornerstone of this technology is hashing.
Hashing takes any data of arbitrary size and transforms it to a data of fixed size via a mathematical algorithm. For example, on the Bitcoin chain transactions go through a hashing algorithm (SHA-256) which gives an output of fixed length- 256 bits. If the data is smaller, the hashing algorithm packs it to reach the desired length, and if it is longer it cuts it down to this size.
Blockchain uses cryptographic hash functions, which have 4 properties that make them secure to use:
- Same input = same hash value: it is not possible to make 2 different hashes from the same input, neither to have the same hash from 2 different inputs;
- Changing the input changes the hash itself;
- Quick to produce a hash for any message;
- Cannot determine input based on the hash value: as in asymmetrically encrypted messages above, you cannot determine the original message from the encrypted format without the key.
With hashing, you can verify the authenticity of a data- if the data you have makes a certain hash, and another data provides a different hash the 2 are not the same. If the hash is the same, the data is the same.
Hashes in blockchain represent the current state of the chain. Each block is connected with the hash of the previous block. As the hash represents all the blocks connected before, it includes by connection the whole chain.
Image source: Ledger Projects
With hashing technology, we can understand how is blockchain technology able to:
- Mash a lot of information in a smaller form;
- Connect one data to another;
- Provide security with storing information in hash format instead of the original.
By Barbora Juhaszova