
Episode 5 - Hashing
Hashing is the process of deriving fixed-length strings from arbitrary-length data. It is generally used to represent data in a more compact and consistent format. For example, a small string like the name of a person and a large file like their resume could both be represented by two different strings of the same length by hashing them (individually) using the same hash function.
Hash Functions
Hashing is done using programs called hash functions. There are several hash functions based on different algorithms. The main characteristics of good hash functions are:
Deterministic — It should generate the same hash from a particular input on any system or hardware.
Irreversible — The hashing process could not be reversed to get the input back.
Fixed-length output — The outputs from a hash function are of the same length irrespective of the length of the input.
Collision-free — The same hash must not be produced for two different inputs.
Hashing Usage In Blockchain
In the context of blockchains, hashing is used in several places. Some of these are:
The cryptographic signing of transactions and blocks. Hashing is generally part of all signing algorithms. All transactions in a blockchain are signed by users and all blocks are signed by their respective miner or producer nodes.
Representation of transactions and blocks using their hashes. In a blockchain, the transactions and blocks are generally represented using their hashes.
Merkle trees used for storage — all non-leaf nodes are hashes of their children. The storage root hash changes even if there is a slight change or update in any of the data stored in the blockchain.
Music: https://www.purple-planet.com