I wanted to pass a MD5 hash generated by Ruby program to a PHP program, and found something strange.
Ruby code(result: ad0efdf609e99ec50d9333dc0bd1c11a)
Digest::MD5.hexdigest 'test str1&test str2&test str3&test str4'
PHP code(result: 804160119894a4cc8c376fffbcc21e1c)
You can see the results are different... but if I remove the "&" in my string:
Ruby code(result: 45fa91e4c89aa6f3bb501531a5de6bf4)
Digest::MD5.hexdigest 'test str1test str2test str3test str4'
PHP code(result: 45fa91e4c89aa6f3bb501531a5de6bf4)
They are the same. Why did this happen? The MD5 algorithm should be same in any language, shouldn't it?