MD5 hash calculates differently on server MD5 hash calculates differently on server linux linux

MD5 hash calculates differently on server


Try to replace (Md5.c line 41)

typedef unsigned long int UINT4;

by

typedef uint32_t UINT4;

(include stdint.h if needed)

On a 64 bits machine long int are (usually) 64 bits long instead of 32

EDIT :

I tried on a 64 bits opteron this solves the problem.


Is the machine that seems to not be working a different architecture (32-bit vs. 64-bit) than the others? If the MD5 implementation is dependent on machine word size (I haven't checked the code), this can cause the hash to be different.


Different compilers can have different levels of standard compliance. If you run into a sub-standard compiler you can have hard times seeing that well-tested code has been compiled to something working entirely different.

It can also happen that the target system is 64-bit and the code has 64-bit portability issues.

The only way to solve the problem is to debug where exactly the two versions of your code behave differently.