I am working on cryptographic hash functions theorems. In the iterated hash functions part a specific word started appearing constantly: "Compress" for instance within the "compress function".

I am trying to find out what the logic is behind this "compress function". Many blogs, PDF's & forums didn't give any particular description about the logic behind "Compress". They just used the word "Compress" and solved the theorems.

Can anyone tell me what is the logic behind the word "Compress" in the compress function?

  • 2
    $\begingroup$ Are you asking what a compression function actually is, or why they are called 'compress functions'? $\endgroup$
    – poncho
    Jul 18, 2016 at 16:51
  • 1
    $\begingroup$ I've tried to mend your question, please edit again if this changed your question somehow. Please include a reference some of the source material (PDF's, forums etc). Please explain what you do not get from this wikipedia article. $\endgroup$
    – Maarten Bodewes
    Jul 18, 2016 at 16:57
  • $\begingroup$ possibly related questoin $\endgroup$
    – Ella Rose
    Jul 18, 2016 at 17:00
  • $\begingroup$ Hi Maarten, Appreciate your response. I was asking about logic behind compress function. For example, say Compress(Z1 || y1). What is compress ?? What action does this Compress do..? Are there any logic gates ?? This is my question $\endgroup$ Jul 19, 2016 at 3:51

1 Answer 1


A compression function is necessary to fulfill the requirements of a hash function. This is because hash functions are expected to be able to accept as input bit strings of arbitrary length, and output a bit string of a constant length*.

The specifics of how the compression function compresses the input string is particular to the construction of the hash function in question. For example, the Merkle–Damgård construction tends to use a block cipher as the compression function. As to how it compresses, it typically uses one block of hash input at a time as the key to a block cipher, and uses this to successively encrypt the internal state.

There is also the sponge construction, which compresses the input data in a different way. The sponge construction holds an internal state consisting of rate + capacity bytes, and "absorbs" rate bytes of hash input into the rate section of the state, either via xor or direct replacement, then mixes the state using an invertible permutation.

*technically there is a reasonable maximum in practice as to the size of the inputs, and the sponge construct is notable for being able to produce arbitrary length outputs.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.