Content deleted Content added
m Reverted edits by 2600:8804:1900:2CA0:B852:C1A5:2D11:E138 (talk) to last version by IdreamofJeanie |
copyedit |
||
Line 1:
In [[cryptography]], a '''one-way compression function''' is a function that transforms two fixed-length inputs into a fixed-length output.<ref>Handbook of Applied Cryptography by Alfred J. Menezes, Paul C. van Oorschot, Scott A. Vanstone. Fifth Printing (August 2001) page 328.</ref> The transformation is [[one-way function|"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
[[Image:One-way compression.svg|thumb|200px|right|A one-way compression function]]
Line 12:
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
Some compression functions
The mixing is done in such a way that full [[avalanche effect]] is achieved. That is, every output bit depends on every input bit.
Line 23:
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
* Preimage-resistance: If an attacker only knows the output it should be unfeasible to calculate an input
* Second preimage-resistance: Given an input ''m1'' whose output is ''h'', it should be unfeasible to find another input ''m2'' that has the same output ''h'' i.e. ''hash''(''m1'')=''hash''(''m2'').
* [[Collision resistance|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 m1 ≠ m2 such that ''hash''(''m1'') = ''hash''(''m2''). Due to the [[Birthday problem|birthday paradox]] (see also [[birthday attack]]) there is a 50% chance a collision can be found in time of about 2<sup>n/2</sup> where 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<sup>n/2</sup> work.
Ideally one would like the "unfeasibility" in preimage-resistance and second preimage-resistance to mean a work of about 2<sup>n</sup> where n is the number of bits in the hash function's output.
== The Merkle–Damgård construction ==
|