When using the MD5 function, is there a way to keep the 32 bit encrypted value printable?
data set_1;
member='JOSEPH';
member2=md5(member);
put member2= / member2 = hex32.;
run;
The above outputs a variable called member2 with non printable values. What I need is the 32 bit md5 printable value. Could someone please help?
Thanks
Isn't the hex32. the printable values one?
data set_1;
member='JOSEPH';
member2=put(md5(member), hex32.);
put member2=;
run;
Isn't the hex32. the printable values one?
data set_1;
member='JOSEPH';
member2=put(md5(member), hex32.);
put member2=;
run;
Hi Reeza, Could you help with this question?
I have a dataset called "list1". It has one variable called "name" with one record. The value in the only record is "joseph". Could you tell me the values for hash1 and hash2 in the below code are not the same? The value for hash 2 is the correct one.
I'm trying to figure out how to get correct md5 hash values for a list of 5 million names in a dataset.
data list2;
set list1;
hash1=put(md5(name),hex32.);
hash2=put(md5('joseph'),hex32.);
run;
Thanks for any help!
md5 is case sensitive. See the code below.
data test;
input name $;
cards;
Joseph
JoSeph
joseph
JOSEPH
;
run;
data want;
set test;
hash=put(md5(name), hex32.);
run;
Thanks for the reply Reeza. Sorry to be a pain but I still can't figure it out. Here's exactly what I'm working on.
I have sample list of 5 email address that I need MD5 hash values for.
This is the sample code I used:
/********************************/
data email_adds;
infile 'C:\Documents and Settings\Joe\Desktop\email_adds.txt'
delimiter='09'x MISSOVER DSD lrecl=32767 firstobs=2 ;
informat EMAIL $29. ;
format EMAIL $29. ;
input EMAIL $;
run;
data email_adds2;
set email_adds;
hash=put(md5(email), hex32.);
run;
/********************************/
Here is the output with INCORRECT hash values:
The hash value for should be CC09B70444EA2093D940D2E86B637416. I confirmed this using an online hash generator (http://www.md5hashgenerator.com/index.php)
I also tried this to confirm. Hash2 is correct:
/********************************/
data test;
email='';
hash=put(md5(email), hex32.);
hash2=put(md5(''), hex32.);
run;
/********************************/
You have trailing in spaces in your data. Add a trim function in to remove the trailing spaces.
hash=put(md5(trim(email)), hex32.);
Thank you!! That worked!
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.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.