01-26-2012 05:14 AM
I very embarrassed because md5 function give me binary output, I would like to get output like this 'bdb8c008fa551ba75f8481963f2201da', can anyone help me with a little script (bin2hex ?)
01-26-2012 08:06 AM
in fact I had allready try format md5(message),hex32.;
it give me '73431DAE446F7EAAC6CD91F92D8E571E'
but it's wrong if I use md5 php's function it give me 'f7a28f0ff962c2a32c1b0a36a78753de' for the same key
01-26-2012 08:58 AM
One possibility - you may not have accounted for how SAS deals with blank characters.
format a $10.;
format b $3.;
a = 'abc';
b = 'abc';
y = md5(a);
z = md5(b);
put y= hex32.;
put z= hex32.;
Yeilds the output:
Were A and B equivalent, their MD5 results would be identical.
I don't have a quick way of running php at work, so I used this site: http://www.functions-online.com/md5.html
The results were:
"abc " (7 spaces) -> 804e99adc4a63980a12cb81d3d62861e
"abc" -> 900150983cd24fb0d6963f7d28e17f72
which seems to confirm, at least for me example.
Hope that helps!