Compression function
A compression function is a function that transforms input information into a shorter or fixed-size representation.
Hacking Cryptography
A function that combines a fixed-size message block with a fixed-size state to produce a new fixed-size state in an iterative hash construction.
- How it is used
- Processes padded fixed-size message blocks into an iterative hash value within Merkle–Damgård constructions.
- How deep it goes
- Defines sequential state updates and contrasts sponge processing, without detailing the internal round function of a specific hash.
- Examples
- Uses MD5, SHA-1, SHA-256, and SHA-512 as Merkle–Damgård hash-function examples.
- What you can do after
- Evaluate/understand how iterative hash constructions transform message blocks into successive internal states.
Read how Hacking Cryptography explains compression function →
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.
- How it is used
- Supports SHA-2 hashing by repeatedly compressing padded message blocks into a final digest.
- 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 you can do after
- Evaluate how SHA-2 transforms padded message blocks into a digest through repeated compression.
Read how Real-World Cryptography explains compression function →
What to know first
- hash functionA hash function is a deterministic function that maps input data to a hash value, typically of fixed size, for uses such as lookup, indexing, comparison, or integrity checking.
Related concepts
- Merkle–Damgård constructionpart of · The Merkle–Damgård construction builds an arbitrary-length hash function by iteratively applying a fixed-size compression function to padded message blocks.
- compressionimplements · Compression is the encoding of data or information in a more compact representation to reduce its size while retaining content needed for recovery or use.
Questions about compression function
What is compression function?
A compression function is a function that transforms input information into a shorter or fixed-size representation.
Which Manning books explain compression function?
Hacking Cryptography and Real-World Cryptography.
What should I know before learning compression function?
Manning books that teach compression function usually introduce hash function first.
What is compression function part of?
Compression function is part of Merkle–Damgård construction. The Merkle–Damgård construction builds an arbitrary-length hash function by iteratively applying a fixed-size compression function to padded message blocks.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.

