So the Davies-Meyer Hash Function is: Hi = Hi−1 ⊕ exi (Hi−1)

Say I pick H0 = 1110 0011

And the message x1 = "5" or "0000 0101"

Is this the correct way to compute H1?

H1 = 1110 0011 ⊕ (0000 0101 ⊕ 1110 0011)

H1 = 1110 0011 ⊕ (1110 0110)

H1 = 0000 0101

I must be doing something wrong because the hash function always comes out the same as the message.


1 Answer 1


The function $e$ takes two values: $x$ and $H$, and then merges them in a specific way. Your "way" is just XORing them. That's insecure, as you can see. Normally you use a block cipher for the function, like AES-128 for an input of 128 bit.

Example: $$ H_i = H_{i-1} \oplus AES_{xi}(H_{i-1}) $$

  • $\begingroup$ what happens if the message to evaluate has size equal to the key size? I make this question because in this case IV and $H_1$ are know, then the message is easy to get. $\endgroup$
    – juaninf
    Commented Dec 31, 2015 at 13:21

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.