Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikipediaThe Free Encyclopedia
Search

One-way compression function

From Wikipedia, the free encyclopedia
Cryptographic primitive

Incryptography, aone-way compression function is a function that transforms two fixed-length inputs into a fixed-length output.[1] 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 conventionaldata compression algorithms, which instead can be inverted exactly (lossless compression) or approximately (lossy compression) to the original data.

A one-way compression function

One-way compression functions are for instance used in theMerkle–Damgård construction insidecryptographic hash functions.

One-way compression functions are often built fromblock ciphers.Some methods to turn any normal block cipher into a one-way compression function areDavies–Meyer,Matyas–Meyer–Oseas,Miyaguchi–Preneel (single-block-length compression functions) andMDC-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 byIBM.)

Another method is2BOW (orNBOW in general), which is a "high-rate multi-block-length hash function based on block ciphers"[2] 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

[edit]

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, andinput 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 fullavalanche effect is achieved. That is, every output bit depends on every input bit.

One-way

[edit]
Main article:one-way function

Aone-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:

Ideally one would like the "infeasibility" in preimage-resistance and second preimage-resistance to mean a work of about2n{\displaystyle 2^{n}} wheren{\displaystyle n} is the number of bits in the hash function's output. However, particularly for second preimage-resistance this is a difficult problem.[citation needed]

The Merkle–Damgård construction

[edit]
Main article:Merkle–Damgård construction
The Merkle–Damgård hash construction. The boxes labeled [f] are a one-way compression function.

A common use of one-way compression functions is in the Merkle–Damgård construction inside cryptographic hash functions. Most widely used hash functions, includingMD5,SHA-1 (which is deprecated[3]) andSHA-2 use this construction.

A hash function must be able to process an arbitrary-length message into a fixed-length output. This can be achieved by breaking the input up into a series of equal-sized blocks, and operating on them in sequence using a one-way compression function. The compression function can either be specially designed for hashing or be built from a block cipher. The last block processed should also belength padded, which is crucial to the security of this construction.

When length padding (also called MD-strengthening) is applied, attacks cannot find collisions faster than the birthday paradox (2n/2{\displaystyle 2^{n/2}},n{\displaystyle n} being the block size in bits) if the used functionf{\displaystyle f} is collision-resistant.[4][5] Hence, the Merkle–Damgård hash construction reduces the problem of finding a proper hash function to finding a proper compression function.

A second preimage attack (given a messagem1{\displaystyle m_{1}} an attacker finds another messagem2{\displaystyle m_{2}} to satisfyhash(m1)=hash(m2){\displaystyle \operatorname {hash} (m_{1})=\operatorname {hash} (m_{2})} can be done according to Kelsey and Schneier[6] for a2k{\displaystyle 2^{k}}-message-block message in timek×2n/2+1+2nk+1{\displaystyle k\times 2^{n/2+1}+2^{n-k+1}}. The complexity of this attack reaches a minimum of23n/4+2{\displaystyle 2^{3n/4+2}} for long messages whenk=2n/4{\displaystyle k=2^{n/4}} and approaches2n{\displaystyle 2^{n}} when messages are short.

Construction from block ciphers

[edit]
A typical modern block cipher

One-way compression functions are often built from block ciphers.

Block ciphers take (like one-way compression functions) two fixed size inputs (thekey and theplaintext) and return one single output (theciphertext) which is the same size as the input plaintext.

However, modern block ciphers are only partially one-way. That is, given a plaintext and a ciphertext it is infeasible to find a key that encrypts the plaintext to the ciphertext. But, given a ciphertext and a key a matching plaintext can be found simply by using the block cipher's decryption function. Thus, to turn a block cipher into a one-way compression function some extra operations have to be added.

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, MDC-4, Hirose (double-block-length compressions functions).

Single-block-length compression functions output the same number of bits as processed by the underlying block cipher. Consequently, double-block-length compression functions output twice the number of bits.

If a block cipher has ablock size of say 128 bits single-block-length methods create a hash function that has the block size of 128 bits and produces a hash of 128 bits. Double-block-length methods 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.

These methods are then used inside the Merkle–Damgård construction to build the actual hash function. These methods are described in detail further down.

Using a block cipher to build the one-way compression function for a hash function is usually somewhat slower than using a specially designed one-way compression function in the hash function. This is because all known secure constructions do thekey scheduling for each block of the message. Black, Cochran and Shrimpton have shown that it is impossible to construct a one-way compression function that makes only one call to a block cipher with a fixed key.[7] In practice reasonable speeds are achieved provided the key scheduling of the selected block cipher is not a too heavy operation.

But, in some cases it is easier because a single implementation of a block cipher can be used for both a block cipher and a hash function. It can also savecode space in very tinyembedded systems like for instancesmart cards ornodes in cars or other machines.

Therefore, the hash-rate or rate gives a glimpse of the efficiency of a hash function based on a certain compression function. The rate of an iterated hash function outlines the ratio between the number of block cipher operations and the output. More precisely, the rate represents the ratio between the number of processed bits of inputm{\displaystyle m}, the output bit-lengthn{\displaystyle n} of the block cipher, and the necessary block cipher operationss{\displaystyle s} to produce thesen{\displaystyle n} output bits. Generally, the usage of fewer block cipher operations results in a better overall performance of the entire hash function, but it also leads to a smaller hash-value which could be undesirable. The rate is expressed by the formula:

Rh=|mi|sn{\displaystyle R_{h}={\frac {\left|m_{i}\right|}{s\cdot n}}}

The hash function can only be considered secure if at least the following conditions are met:

  • The block cipher has no special properties that distinguish it from ideal ciphers, such as weak keys or keys that lead to identical or related encryptions (fixed points or key-collisions).
  • The resulting hash size is big enough. According to thebirthday attack asecurity level of 280 (generally assumed to be infeasible to compute today)[citation needed] is desirable thus the hash size should be at least 160 bits.
  • The last block is properly length padded prior to the hashing. (SeeMerkle–Damgård construction.) Length padding is normally implemented and handled internally in specialised hash functions likeSHA-1 etc.

The constructions presented below: Davies–Meyer, Matyas–Meyer–Oseas, Miyaguchi–Preneel and Hirose have been shown to be secure under theblack-box analysis.[8][9] The goal is to show that any attack that can be found is at most as efficient as thebirthday attack under certain assumptions. The black-box model assumes that a block cipher is used that is randomly chosen from a set containing all appropriate block ciphers. In this model an attacker may freely encrypt and decrypt any blocks, but does not have access to an implementation of the block cipher. The encryption and decryption function are represented by oracles that receive a pair of either a plaintext and a key or a ciphertext and a key. The oracles then respond with a randomly chosen plaintext or ciphertext, if the pair was asked for the first time. They both share a table for these triplets, a pair from the query and corresponding response, and return the record, if a query was received for the second time. For the proof there is a collision finding algorithm that makes randomly chosen queries to the oracles. The algorithm returns 1, if two responses result in a collision involving the hash function that is built from a compression function applying this block cipher (0 else). The probability that the algorithm returns 1 is dependent on the number of queries which determine the security level.

Davies–Meyer

[edit]
The Davies–Meyer one-way compression function

The Davies–Meyer single-block-length compression function feeds each block of the message (mi{\displaystyle m_{i}}) as the key to a block cipher. It feeds the previous hash value (Hi1{\displaystyle H_{i-1}}) as the plaintext to be encrypted. The output ciphertext is then alsoXORed (⊕) with the previous hash value (Hi1{\displaystyle H_{i-1}}) to produce the next hash value (Hi{\displaystyle H_{i}}). In the first round when there is no previous hash value it uses a constant pre-specified initial value (H0{\displaystyle H_{0}}).

Inmathematical notation Davies–Meyer can be described as:

Hi=Emi(Hi1)Hi1{\displaystyle H_{i}=E_{m_{i}}{(H_{i-1})}\oplus {H_{i-1}}}

The scheme has the rate (k is the keysize):

RDM=k1n=kn{\displaystyle R_{DM}={\frac {k}{1\cdot n}}={\frac {k}{n}}}

If the block cipher uses for instance 256-bit keys then each message block (mi{\displaystyle m_{i}}) is a 256-bit chunk of the message. If the same block cipher uses a block size of 128 bits then the input and output hash values in each round is 128 bits.

Variations of this method replace XOR with any other group operation, such as addition on 32-bit unsigned integers.

A notable property of the Davies–Meyer construction is that even if the underlying block cipher is totally secure, it is possible to computefixed points for the construction: for anym{\displaystyle m}, one can find a value ofh{\displaystyle h} such thatEm(h)h=h{\displaystyle E_{m}(h)\oplus h=h}: one just has to seth=Em1(0){\displaystyle h=E_{m}^{-1}(0)}.[10] This is a property thatrandom functions certainly do not have. So far, no practical attack has been based on this property, but one should be aware of this "feature". The fixed-points can be used in a second preimage attack (given a messagem1{\displaystyle m_{1}}, attacker finds another messagem2{\displaystyle m_{2}} to satisfyhash(m1)=hash(m2){\displaystyle \operatorname {hash} (m_{1})=\operatorname {hash} (m_{2})}) of Kelsey and Schneier[6] for a2k{\displaystyle 2^{k}}-message-block message in time3×2n/2+1+2nk+1{\displaystyle 3\times 2^{n/2+1}+2^{n-k+1}}. If the construction does not allow easy creation of fixed points (like Matyas–Meyer–Oseas or Miyaguchi–Preneel) then this attack can be done ink×2n/2+1+2nk+1{\displaystyle k\times 2^{n/2+1}+2^{n-k+1}} time. In both cases the complexity is above2n/2{\displaystyle 2^{n/2}} but below2n{\displaystyle 2^{n}} when messages are long and that when messages get shorter the complexity of the attack approaches2n{\displaystyle 2^{n}}.

The security of the Davies–Meyer construction in the Ideal Cipher Model was first proven by R. Winternitz.[11]

Matyas–Meyer–Oseas

[edit]
The Matyas–Meyer–Oseas one-way compression function

The Matyas–Meyer–Oseas single-block-length one-way compression function can be considered the dual (the opposite) of Davies–Meyer.

It feeds each block of the message (mi{\displaystyle m_{i}}) as the plaintext to be encrypted. The output ciphertext is then also XORed (⊕) with the same message block (mi{\displaystyle m_{i}}) to produce the next hash value (Hi{\displaystyle H_{i}}). The previous hash value (Hi1{\displaystyle H_{i-1}}) is fed as the key to the block cipher. In the first round when there is no previous hash value it uses a constant pre-specified initial value (H0{\displaystyle H_{0}}).

If the block cipher has different block and key sizes the hash value (Hi1{\displaystyle H_{i-1}}) will have the wrong size for use as the key. The cipher might also have other special requirements on the key. Then the hash value is first fed through the functiong{\displaystyle g} to be converted/padded to fit as key for the cipher.

In mathematical notation Matyas–Meyer–Oseas can be described as:

Hi=Eg(Hi1)(mi)mi{\displaystyle H_{i}=E_{g(H_{i-1})}(m_{i})\oplus m_{i}}

The scheme has the rate:

RMMO=n1n=1{\displaystyle R_{MMO}={\frac {n}{1\cdot n}}=1}

A second preimage attack (given a messagem1{\displaystyle m_{1}} an attacker finds another messagem2{\displaystyle m_{2}} to satisfyhash(m1)=hash(m2){\displaystyle \operatorname {hash} (m_{1})=\operatorname {hash} (m_{2})}) can be done according to Kelsey and Schneier[6] for a2k{\displaystyle 2^{k}}-message-block message in timek×2n/2+1+2nk+1{\displaystyle k\times 2^{n/2+1}+2^{n-k+1}}. The complexity is above2n/2{\displaystyle 2^{n/2}} but below2n{\displaystyle 2^{n}} when messages are long, and that when messages get shorter the complexity of the attack approaches2n{\displaystyle 2^{n}}.

Miyaguchi–Preneel

[edit]
The Miyaguchi–Preneel one-way compression function

The Miyaguchi–Preneel single-block-length one-way compression function is an extended variant of Matyas–Meyer–Oseas. It was independently proposed byShoji Miyaguchi andBart Preneel.

It feeds each block of the message (mi{\displaystyle m_{i}}) as the plaintext to be encrypted. The output ciphertext is then XORed (⊕) with the same message block (mi{\displaystyle m_{i}}) and then also XORed with the previous hash value (Hi1{\displaystyle H_{i-1}}) to produce the next hash value (Hi{\displaystyle H_{i}}). The previous hash value (Hi1{\displaystyle H_{i-1}}) is fed as the key to the block cipher. In the first round when there is no previous hash value it uses a constant pre-specified initial value (H0{\displaystyle H_{0}}).

If the block cipher has different block and key sizes the hash value (Hi1{\displaystyle H_{i-1}}) will have the wrong size for use as the key. The cipher might also have other special requirements on the key. Then the hash value is first fed through the functiong{\displaystyle g} to be converted/padded to fit as key for the cipher.

In mathematical notation Miyaguchi–Preneel can be described as:

Hi=Eg(Hi1)(mi)Hi1mi{\displaystyle H_{i}=E_{g(H_{i-1})}(m_{i})\oplus H_{i-1}\oplus m_{i}}

The scheme has the rate:

RMP=n1n=1{\displaystyle R_{MP}={\frac {n}{1\cdot n}}=1}

The roles ofmi{\displaystyle m_{i}} andHi1{\displaystyle H_{i-1}} may be switched, so thatHi1{\displaystyle H_{i-1}} is encrypted under the keymi{\displaystyle m_{i}}, thus making this method an extension of Davies–Meyer instead.

A second preimage attack (given a messagem1{\displaystyle m_{1}} an attacker finds another messagem2{\displaystyle m_{2}} to satisfyhash(m1)=hash(m2){\displaystyle \operatorname {hash} (m_{1})=\operatorname {hash} (m_{2})}) can be done according to Kelsey and Schneier[6] for a2k{\displaystyle 2^{k}}-message-block message in timek×2n/2+1+2nk+1{\displaystyle k\times 2^{n/2+1}+2^{n-k+1}}. The complexity is above2n/2{\displaystyle 2^{n/2}} but below2n{\displaystyle 2^{n}} when messages are long, and that when messages get shorter the complexity of the attack approaches2n{\displaystyle 2^{n}}.

Hirose

[edit]
The Hirose double-block-length compression function

The Hirose[9] double-block-length one-way compression function consists of a block cipher plus a permutationp{\displaystyle p}. It was proposed by Shoichi Hirose in 2006 and is based on a work[12] byMridul Nandi.

It uses a block cipher whose key lengthk{\displaystyle k} is larger than the block lengthn{\displaystyle n}, and produces a hash of size2n{\displaystyle 2n}. For example, any of theAES candidates with a 192- or 256-bit key (and 128-bit block).

Each round accepts a portion of the messagemi{\displaystyle m_{i}} that iskn{\displaystyle k-n} bits long, and uses it to update twon{\displaystyle n}-bit state valuesG{\displaystyle G} andH{\displaystyle H}.

First,mi{\displaystyle m_{i}} is concatenated withHi1{\displaystyle H_{i-1}} to produce a keyKi{\displaystyle K_{i}}. Then the two feedback values are updated according to:

p(Gi1){\displaystyle p(G_{i-1})} is an arbitrary fixed-point-free permutation on ann{\displaystyle n}-bit value, typically defined asp(x)=xc{\displaystyle p(x)=x\oplus c} for an arbitrary non-zero constantc{\displaystyle c} (all ones may be a convenient choice).

Each encryption resembles the standard Davies–Meyer construction. The advantage of this scheme over other proposed double-block-length schemes is that both encryptions use the same key, and thus key scheduling effort may be shared.

The final output isHt||Gt{\displaystyle H_{t}||G_{t}}. The scheme has the rateRHirose=kn2n{\textstyle R_{Hirose}={\frac {k-n}{2n}}} relative to encrypting the message with the cipher.

Hirose also provides a proof in the Ideal Cipher Model.

Sponge construction

[edit]

Thesponge construction can be used to build one-way compression functions.

See also

[edit]

References

[edit]

Citations

[edit]
  1. ^Handbook of Applied Cryptography by Alfred J. Menezes, Paul C. van Oorschot, Scott A. Vanstone. Fifth Printing (August 2001) page 328.
  2. ^US10680802B2, Fay, Bjorn, "High-rate multi-block-length hash function based on block ciphers", issued 2020-06-09 
  3. ^"Announcing the first SHA1 collision".Google Online Security Blog. Retrieved2020-01-12.
  4. ^Ivan Damgård.A design principle for hash functions. In Gilles Brassard, editor, CRYPTO, volume 435 of LNCS, pages 416–427. Springer, 1989.
  5. ^Ralph Merkle.One way hash functions and DES. In Gilles Brassard, editor, CRYPTO, volume 435 of LNCS, pages 428–446. Springer, 1989.
  6. ^abcdJohn Kelsey and Bruce Schneier.Second preimages onn-bit hash functions for much less than 2n work. In Ronald Cramer, editor, EUROCRYPT, volume 3494 of LNCS, pages 474–490. Springer, 2005.
  7. ^John Black, Martin Cochran, and Thomas Shrimpton.On the Impossibility of Highly-Efficient Blockcipher-Based Hash Functions. Advances in Cryptology – EUROCRYPT '05, Aarhus, Denmark, 2005. The authors define a hash function "highly efficient if its compression function uses exactly one call to a block cipher whose key is fixed".
  8. ^John Black, Phillip Rogaway, and Tom Shrimpton.Black-Box Analysis of the Block-Cipher-Based Hash-Function Constructions from PGV. Advances in Cryptology – CRYPTO '02, Lecture Notes in Computer Science, vol. 2442, pp. 320–335, Springer, 2002. See the table on page 3, Davies–Meyer, Matyas–Meyer–Oseas and Miyaguchi–Preneel are numbered in the first column as hash functions 5, 1 and 3.
  9. ^abS. Hirose,Some Plausible Constructions of Double-Block-Length Hash Functions. In: Robshaw, M. J. B. (ed.) FSE 2006, LNCS, vol. 4047, pp. 210–225, Springer, Heidelberg 2006.
  10. ^Handbook of Applied Cryptography by Alfred J. Menezes, Paul C. van Oorschot, Scott A. Vanstone. Fifth Printing (August 2001) page 375.
  11. ^R. Winternitz.A secure one-way hash function built from DES. In Proceedings of the IEEE Symposium on Information Security and Privacy, p. 88-90. IEEE Press, 1984.
  12. ^M. Nandi,Towards optimal double-length hash functions, In: Proceedings of the 6th International Conference on Cryptology in India (INDOCRYPT 2005), Lecture Notes in Computer Science 3797, pages 77–89, 2005.

Sources

[edit]
Common functions
SHA-3 finalists
Other functions
Password hashing/
key stretching functions
General purpose
key derivation functions
MAC functions
Authenticated
encryption
modes
Attacks
Design
Standardization
Utilization
General
Mathematics
Retrieved from "https://en.wikipedia.org/w/index.php?title=One-way_compression_function&oldid=1310936267"
Categories:
Hidden categories:

[8]ページ先頭

©2009-2025 Movatter.jp