A cryptographic hash function is a mathematical algorithm that converts an input (or ‘message’) into a fixed-size string of bytes, typically a digest, that appears random. In blockchain technology, these functions are essential for maintaining the integrity and security of the blockchain.
They are used to create a unique identifier for each block and its contents. The main properties of a cryptographic hash function include being deterministic (the same input will always produce the same output), fast computation, infeasibility of generating the original input from its hash (pre-image resistance), a small change in input producing a significantly different output (avalanche effect), and resistance to collisions (two different inputs producing the same output). Examples include SHA-256 (used in Bitcoin) and Keccak-256 (used in Ethereum).