Skip to content
uencoder

Merkle-Damgård Construction

The Merkle-Damgård construction is the classic framework for iterative hashing: the message is split into blocks and chained through compression function f: h_i=f(h_{i-1}, m_i).

Purpose

Extends a fixed-input-length compression function into a hash of arbitrary-length input — the underlying structure of MD5/SHA-1/SHA-2.

Mechanism

The message is padded to a multiple of the block length (including the length encoding); starting from initial value h_0=IV, iterate h_i=f(h_{i-1}, m_i), output h_n. Weaknesses: length-extension attacks, multicollisions.

Use cases

  • Foundation of MD5/SHA-1/SHA-2
  • Iterative hash design
  • Cryptography education

Related tools

References