0
$\begingroup$

I followed the algorithm step by step in MD5 Algorithm but in the first loop of the 64 loops, I got my A as 10325476, B as 35E4F8C4D, C as EFCDAB89 and D as 98BADCFE in hexadecimal. A, b, C and D will be appended in the end to become the md5 checksum. This makes me confuse as in the first loop, the length of hexadecimal is already 9. I believe that by continuing the algorithm, B will become bigger and bigger. This means that I will not get exactly 32 hexadecimal number in the end as 8+9+8+8!=32 Am I on the correct path or my hexadecimal length of B is indicating that I am calculating wrongly?

$\endgroup$
0

1 Answer 1

3
$\begingroup$

In MD5, the addition performed on $B$ at each round is modulo $2^{32}$ (that is, only the 32 low-order bits of the result are kept); same for the additions involving $A$, $F$, $K$ and $M$ at each round, and the four additions on $A$, $B$, $C$ and $D$ at the end of the 64 rounds.

Therefore, $A$, $B$, $C$ and $D$ all remain within 32 bits. At the end of the hashing, the concatenation of their representation as 32 bits forms the final hash, which is thus exactly 128-bit.

$\endgroup$

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.