What Is Hash Function?
Also known as: Cryptographic Hash Function, Hashing Algorithm, Hash Algorithm
In short
A hash function is a mathematical function that converts data of any length into a fixed-length, fingerprint-like output (a hash or digest); the security and data integrity of blockchains rely heavily on cryptographic hash functions.
Cryptographic hash functions have several core properties. They are deterministic: the same input always gives the same output. They are one-way: finding the input from the output is practically impossible. They are collision resistant: finding two different inputs that give the same output is extremely difficult. In addition, changing a single character in the input causes the entire output to change; this is called the avalanche effect.
Bitcoin uses the SHA-256 algorithm. Because each block contains the hash of the previous block, the smallest change in a past block breaks all subsequent links and is noticed immediately; this is what makes the chain effectively immutable. In Proof of Work mining, miners make a large number of attempts, changing the nonce value, until the hash of the block header falls below a certain target value. Ethereum, on the other hand, uses Keccak-256 for address generation and data structures.
Hash functions are also used in creating transaction IDs (TxID), in Merkle trees, in deriving addresses from public keys, and in digital signatures. For this reason, older algorithms such as MD5 and SHA-1, whose cryptographic weaknesses have come to light, are not preferred in blockchain systems.
Last updated: · This content is for information purposes only and is not investment advice.

