MD5 issue


#1

Hi all,
I tried to generate check sum using juce MD5, The check sum that it returned was different from what i got from different web sites(check sum from different web sites where same).
The sites that i had used were :
http://www.adamek.biz/md5-generator.php
http://www.miraclesalad.com/webtools/md5.php
http://www.md5generator.com/

I don’t understand it because check sum cannot be different for the same string. I am putting in a snippet of my code.

        juce::MD5 checkSum = juce::MD5 (T("vishveshkd@gmail.com")); 
	juce::Logger::outputDebugString(T("Check sum : ") + checkSum.toHexString());
  This logs "7f949c6a27ae1ec40cd820f355a5d66e" but the web sites show "0a0adbe3f198497ae75a9e167490af81".

Is there something am doing wrong or it’s an issue with juce am working with juce 1.46. It can be generated on both mac and pc.

regards,
vishvesh


#2

The juce code will operate on strings as unicode - maybe the websites are treating it as utf8 or ascii?


#3

is there anyway i can generate the same value as those generated by the web-sites


#4

Try feeding it a utf8 binary instead of a string?


#5

it didn’t work am still getting the same value.


#6

If you got the same result, then obviously you’re feeding it the same data (!!)

Make sure you’re calling the binary constructor, and not the one that takes a string!


#7

yeah you were right :oops: . I had to use “MD5 (const char* data, const int numBytes)”

thanks julian