One-way compression function: Difference between revisions

Content deleted Content added
Mangojuice (talk | contribs)
grammar, wording changes
Line 1:
In [[cryptography]], there are several methods to use a [[block cipher]] to build a [[cryptographic hash function]]. The methods resemblesresemble the [[block cipher modes of operation]] usually used for encryption.
 
Some methods to turn any normal block cipher into the ''compression function'' for a hash function are '''Davies-Meyer''', '''Miyaguchi-Preneel''', '''Matyas-Meyer-Oseas''', '''MDC-2''' and '''MDC-4'''. They are then used inside the '''Merkle-Damgård structure''' to build the actual hash function. These methods are described in detail further down. ([[MDC-2]] is also the name of a hash function patented by IBM.)
 
Using a block cipher as a hash function usually is usually much slower than using a specially designed hash function. But, in some cases it might beis easier sincebecause ita meanssingle justimplementation implementingof a block cipher andcan thenbe usingused itfor both as a block cipher and a hash function. It can also save code space in very tiny [[embedded system]]s like for instance [[smart card]]s or nodes in cars or other machines.
 
If a block cipher has a [[Block size (cryptography)|block size]] of say 128 bits most of the methods create a hash function that has the block size of 128 bits and produces a hash of 128 bits. But there are also methods to make hashes with double the hash size compared to the block size of the block cipher used. So a 128-bit block cipher can be turned into a 256-bit hash function.
 
The hash function is secure if the following conditions are met:
* The block cipher needs to beis secure.
* The resulting hash size needs to beis big enough. 64-bit is too small, 128-bit might be enough.
* The last block needs to beis properly [[Padding (cryptography)|length padded]] prior to the hashing. (See the Merkle-Damgård structure below.) Length padding is normally implemented and handled internally in specialised hash functions like [[SHA-1]] etc.
 
== The Merkle-Damgård structure ==