Different results between PHP md5() and Ruby Digest::MD5.hexdigest -
i wanted pass md5 hash generated ruby program php program, , found strange.
ruby code(result: ad0efdf609e99ec50d9333dc0bd1c11a)
digest::md5.hexdigest 'test str1&test str2&test str3&test str4'
php code(result: 804160119894a4cc8c376fffbcc21e1c)
you can see results different... if remove "&" in string:
ruby code(result: 45fa91e4c89aa6f3bb501531a5de6bf4)
digest::md5.hexdigest 'test str1test str2test str3test str4'
php code(result: 45fa91e4c89aa6f3bb501531a5de6bf4)
they same. why did happen? md5 algorithm should same in language, shouldn't it?
the results of website wrong.
here comes example (using php on command line):
php -r 'echo md5("test str1&test str2&test str3&test str4");'
output:
ad0efdf609e99ec50d9333dc0bd1c11a
Comments
Post a Comment