# Davies-Meyer Hash Function

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.

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})$$
• 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. – juaninf Dec 31 '15 at 13:21