ArticleslgStudy

mathematics

One-way compression function

One-way compression function is a mathematics topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand One-way compression function rather than just read about it. In short: In cryptography, a one-way compression function is a function that transforms two fixed-length inputs into a fixed-length output. The transformation is "one-way", meaning that it is difficult given a particular output to compute inputs which compress to that output.

One-way compression function — main illustration
One-way compression function — illustration

Key takeaways

  • One-way compression function belongs to mathematics; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect One-way compression function to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of One-way compression function from memory before moving on to harder problems.

Reference excerpt

In cryptography, a one-way compression function is a function that transforms two fixed-length inputs into a fixed-length output. The transformation is "one-way", meaning that it is difficult given a particular output to compute inputs which compress to that output. One-way compression functions are not related to conventional data compression algorithms, which instead can be inverted exactly (lossless compression) or approximately (lossy compression) to the original data.

One-way compression functions are for instance used in the Merkle–Damgård construction inside cryptographic hash functions. One-way compression functions are often built from block ciphers. Some methods to turn any normal block cipher into a one-way compression function are Davies–Meyer, Matyas–Meyer–Oseas, Miyaguchi–Preneel (single-block-length compression functions) and MDC-2/Meyer–Schilling, MDC-4, Hirose (double-block-length compression functions). These methods are described in detail further down. (MDC-2 is also the name of a hash function patented by IBM.) Another method is 2BOW (or NBOW in general), which is a "high-rate multi-block-length hash function based on block ciphers" and typically achieves (asymptotic) rates between 1 and 2 independent of the hash size (only with small constant overhead). This method has not yet seen any serious security analysis, so should be handled with care.

Compression A compression function mixes two fixed length inputs and produces a single fixed length output of the same size as one of the inputs. This can also be seen as that the compression function transforms one large fixed-length input into a shorter, fixed-length output. For instance, input A might be 128 bits, input B 128 bits and they are compressed together to a single output of 128 bits. This is equivalent to having a single 256-bit input compressed to a single output of 128 bits. Some compression functions do not compress by half, but instead by some other factor. For example, input A might be 256 bits, and input B 128 bits, which are compressed to a single output of 128 bits. That is, a total of 384 input bits are compressed together to 128 output bits. The mixing is done in such a way that full avalanche effect is achieved. That is, every output bit depends on every input bit.

One-way

A one-way function is a function that is easy to compute but hard to invert. A one-way compression function (also called hash function) should have the following properties:

Easy to compute: If you have some input(s), it is easy to calculate the output. Preimage-resistance: If an attacker only knows the output it should be infeasible to calculate an input. In other words, given an output h {\displaystyle h} , it should be unfeasible to calculate an input m {\displaystyle m} such that hash ⁡ ( m ) = h {\displaystyle \operatorname {hash} (m)=h} . Second preimage-resistance: Given an input m 1 {\displaystyle m_{1}} whose output is h {\displaystyle h} , it should be infeasible to find another input m 2 {\displaystyle m_{2}} that has the same output h {\displaystyle h} , i.e. hash ⁡ ( m 1 ) = hash ⁡ ( m 2 ) {\displaystyle \operatorname {hash} (m_{1})=\operatorname {hash} (m_{2})} . Collision-resistance: It should be hard to find any two different inputs that compress to the same output i.e. an attacker should not be able to find a pair of messages m 1 ≠ m 2 {\displaystyle m_{1}\neq m_{2}} such that hash ⁡ ( m 1 ) = hash ⁡ ( m 2 ) {\displaystyle \operatorname {hash} (m_{1})=\operatorname {hash} (m_{2})} . Due to the birthday paradox (see also birthday attack) there is a 50% chance a collision can be found in time of about 2 n / 2 {\displaystyle 2^{n/2}} where n {\displaystyle n} is the number of bits in the hash function's output. An attack on the hash function thus should not be able to find a collision with less than about 2 n / 2 {\displaystyle 2^{n/2}} work. Ideally one would like the "infeasibility" in preimage-resistance and second preimage-resistance to mean a work of about 2 n {\displaystyle 2^{n}} where n {\displaystyle n} is the number of bits in the hash function's output. However, particularly for second preimage-resistance this is a difficult problem.

The Merkle–Damgård construction

… excerpt ends here. Continue reading the full article.

Illustrations

One-way compression function: A one-way compression function
A one-way compression function
One-way compression function: The Merkle–Damgård hash construction. The boxes labeled [f] are a one-way compression function.
The Merkle–Damgård hash construction. The boxes labeled [f] are a one-way compression function.
One-way compression function: A typical modern block cipher
A typical modern block cipher
One-way compression function: The Davies–Meyer one-way compression function
The Davies–Meyer one-way compression function
One-way compression function: The Matyas–Meyer–Oseas one-way compression function
The Matyas–Meyer–Oseas one-way compression function

Worked examples

Example 1 — a first encounter with One-way compression function

Start with the simplest possible case. Write down what One-way compression function claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In mathematics, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to One-way compression function before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about One-way compression function ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of One-way compression function

In research
One-way compression function appears in mathematics research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses One-way compression function in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
One-way compression function is common in secondary-school and first-year university syllabi. It links to neighbouring topics Cryptographic hash functions, Cryptographic primitives, so understanding it makes those chapters shorter.
In everyday life
Look for One-way compression function outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.

Affiliate

Preply — study more efficiently by working with a personal tutor. 50% off.

How to study One-way compression function in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what One-way compression function means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain One-way compression function out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is One-way compression function in simple terms?

In cryptography, a one-way compression function is a function that transforms two fixed-length inputs into a fixed-length output. The transformation is "one-way", meaning that it is difficult given a particular output to compute inputs which compress to that output.

Why does One-way compression function matter?

Because it connects several mathematics ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study One-way compression function?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on One-way compression function.

Tags

  • Cryptographic hash functions
  • Cryptographic primitives

Keep exploring