Hash Functions in Practice

Let’s have a look at the various hashing techniques proposed over the years.

Hash function design

We won’t discuss any particular hash function designs in detail since hash functions are often relatively complex cryptographic primitives to describe. Still, the following notes present a brief indication of how hash functions have traditionally been designed.

  • One popular design technique is to build iterated hash functions. Hash functions of this type are designed to operate in rounds, very much like a block cipher. Each round takes an input of a fixed size (typically a combination of the most recent message block and the output of the last round) and applies a compression function to produce an output of the required hash length. This process is repeated for as many rounds as are required to hash the entire message.

  • The Merkle–Damgard construction is a particular type of iterated hash function on which many modern hash functions are based. This design has proved popular because it’ is possible to show that if the security properties we want our hash function to have applied to the compression function used in each round, these same security properties would hold for the whole hash function.

  • Hash functions can either be dedicated designs (meaning they are designed explicitly as hash functions) or based on block ciphers. The latter constructions typically employ a block cipher in designing a compression function, which is then iterated.

Get hands-on with 1200+ tech skills courses.