BookmarkSubscribeRSS Feed
julienr
Calcite | Level 5

Hello,

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 ?)

thank's

4 REPLIES 4
yobaNew
Calcite | Level 5

Hello,

You could try put(md5(message),hex32.),

Regards,

Yoba

julienr
Calcite | Level 5

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

DF
Fluorite | Level 6 DF
Fluorite | Level 6

One possibility - you may not have accounted for how SAS deals with blank characters.

For example:

data _null_;

    format a $10.;

    format b $3.;

    a = 'abc';

    b = 'abc';

    y = md5(a);

    z = md5(b);

    put y= hex32.;

    put z= hex32.;

run;

Yeilds the output:

y=804E99ADC4A63980A12CB81D3D62861E

z=900150983CD24FB0D6963F7D28E17F72

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!

julienr
Calcite | Level 5

very instructive thanks a lot

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 3374 views
  • 0 likes
  • 3 in conversation