liveBook · Manning

Compression function

As explained in Real-World Cryptography

A compression function maps two inputs to one output whose size is the size of one input, thereby reducing represented data size.

A compression function takes two inputs and produces one output whose size matches one input. In plain terms, it turns more represented data into less. section 2.5.1

Within SHA-2, the function works as part of a larger sequence:

  • A Davies–Meyer construction builds the function from a block cipher. section 2.5.1
  • Merkle–Damgård first pads a message and cuts it into fixed-size blocks. section 2.5.1
  • It then applies the compression function repeatedly, feeding each previous output into the next call. section 2.5.1
Figure 2.7 A compression function takes two different inputs of size X and Y (here both 16 bytes) and returns an output of size either X or Y.

A size diagram makes the input-to-output reduction concrete before the construction details become more involved. section 2.5.1

How Real-World Cryptography covers it

How deep it goes
Defines the size reduction and outlines Davies–Meyer and Merkle–Damgård, but defers block-cipher details.
Examples
Uses a size diagram, an eight-byte block padding example, and an iterative compression diagram.
What it assumes
Assumes basic hashing context and introduces XOR, while deferring block-cipher understanding.
What you can do after
Evaluate how SHA-2 transforms padded message blocks into a digest through repeated compression.
How it connects
Connects compression functions with SHA-2, block ciphers, Davies–Meyer, Merkle–Damgård, padding, and XOR.

Also explained in

Compare how 2 books explain compression function →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Real-World Cryptography. The section links point to the parts of the book it draws on.