Every time your browser validates a download, a password manager stores a credential, or a blockchain commits a block, it calls a hash function — an algorithm that crushes an arbitrarily long message down to a fixed-length digest. SHA-256 produces 256 bits whether the input is a single byte or the entire text of Wikipedia.
That sounds magical. How do you accept any length of input but always produce the same length of output? The answer, published independently by Ralph Merkle (1979) and Ivan Damgård (1989), is disarmingly simple: break the message into fixed-size blocks and chain them through a small, fixed-length compression function.
The Merkle–Damgård construction does not invent new mathematics — it is an architecture. Given a compression function that takes a fixed-size chaining value and a fixed-size block and produces a new chaining value, the construction shows how to build a full hash function from it. The proof of security is elegant: if the compression function is collision-resistant, so is the resulting hash.
That elegant proof, however, comes with a hidden trap — the length-extension attack — which SHA-3 was specifically designed to avoid. Understanding Merkle–Damgård means understanding both the insight and the flaw.
Comments
Loading comments...