BookmarkSubscribeRSS Feed
RobertNYC
Obsidian | Level 7

Hi all, 

 

I'm looking for a program to take a string variable (email address) and create a hash for the value in each row via either MD5 or SHA-1. 

 

Tried using the sha256 function, because it was all I could find, but it is not the correct hashing algorithm which I need to apply.   I need to use MD5 or SHA_1.   Any assistance will be greatly appreciated.

 

Thanks!

 

data want;

set have;

  format hash $hex64.;

hash=sha256(EMAIL_ADDRESS);; run;

3 REPLIES 3
RW9
Diamond | Level 26 RW9
Diamond | Level 26

Hi,

 

I may have missed something here, but from my understanding MD5 is an algorithm for ensuring a file is complete and unchanged from a sender.  I think SHA-1 is a simliar technology, but I don't know that one off the top of my head.  Could you clarify your requirements, i.e. what needs to be encrpyted, why it needs it, and why those particular technologies?  If you just want to hide a password or email then there is this function:

http://support.sas.com/documentation/cdl/en/proc/61895/HTML/default/viewer.htm#a002595988.htm

 

But that has nothing to do with MD5.  Or alternatively you could get a free command line MD5 generator program and use that to do the job:

https://www.fourmilab.ch/md5/

E.g. 

infile tmp pipe 'md5gen "c:\tmp.txt"';
data want;
  length mymd5 $100;
  infile tmp;
  input mymd5 $;
run;
ChrisHemedinger
Community Manager

In just over one month an approach will be available as part of SAS Global Forum proceedings, thanks to a paper by Rick Langston.  Rick's paper shows how you can take a well-documented C-language algorithm and implement in DATA step.  It's fascinating!

SAS INNOVATE 2024

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

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.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

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

View all other training opportunities.

Discussion stats
  • 3 replies
  • 2334 views
  • 1 like
  • 4 in conversation