Help using Base SAS procedures

format md5 output

Reply
New Contributor
Posts: 3

format md5 output

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

N/A
Posts: 1

format md5 output

Hello,

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

Regards,

Yoba

New Contributor
Posts: 3

format md5 output

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

Frequent Contributor
Frequent Contributor
Posts: 94

format md5 output

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!

New Contributor
Posts: 3

format md5 output

very instructive thanks a lot

Ask a Question
Discussion stats
  • 4 replies
  • 1467 views
  • 0 likes
  • 3 in conversation