A hash function is a mathematical function that converts input data of arbitrary length into a fixed-size output called a hash or digest.

For cryptographic applications, important properties include resistance to recovering suitable input data from a hash, finding different inputs with the same output, and finding an input that produces a chosen output. The exact security properties depend on the algorithm.

Hash functions are widely used in blockchains. They contribute to block identifiers, links between blocks, data verification, and various consensus mechanisms. In Proof-of-Work, hash computation is the basis of the process used to search for valid block solutions.

Ordinary hash functions must be distinguished from cryptographic hash functions. Not every hash function provides the properties required to resist deliberate attacks.

Important properties

  • deterministic output;
  • efficient computation;
  • difficulty of recovering suitable input data;
  • difficulty of finding collisions;
  • strong sensitivity to changes in the input.

Even a small change in the input normally produces a completely different hash. This makes hashes useful as digital fingerprints and allows blockchain systems to cryptographically link elements of a chain.