BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
GPatel
Pyrite | Level 9

Dear SAS Communities Members:

 

Following SAS code encrypts Make and Model well. How can I apply Decryption to create Make_R and Mode_R variables from encrypted HASH field ? 

( P.S. I don't want to use MD5 encryption.)

 

data cars;
length hash $ 32;
format hash $hex64.;
set sashelp.cars;
hash = sha256(cats(make,model));
run;

 

OR

I have alphanumeric variable and numeric variable.

How can I encrypt and decrypt them without using MD5.

 

I have an alphanumeric variable and numeric variables.

How can I encrypt and decrypt them without using MD5.
Data a;

input ID $ dept  SALARY;

cards;

ABC123 10020 45000

;

RUN;

1 ACCEPTED SOLUTION

Accepted Solutions
Kurt_Bremser
Super User

Both SHA256 and MD5 are hashing algorithms, not encrypting algorithms. They produce the same length of key, regardless of the input. The source could be a single word, or the combined works of William Shakespeare. There is no way of decrypting them, only of finding a string that incidentally results in the same hash. How much computing power you need to find such a value is a measure for the quality of the hash.

To get the original values back from such a hash, you need to keep a lookup table with original value and hash.

View solution in original post

3 REPLIES 3
SASKiwi
PROC Star

The SAS-supplied hashing algorithms SHA256 and MD5 are for one-way encryption with no (easy) means of decryption. They rely on you retaining the original unencrypted version of your data.

 

If your use case is to exchange encrypted SAS data with other parties that can easily be decrypted then I suggest using tools like 7-zip where you do file or folder password-secured encryption / decryption. 

Kurt_Bremser
Super User

Both SHA256 and MD5 are hashing algorithms, not encrypting algorithms. They produce the same length of key, regardless of the input. The source could be a single word, or the combined works of William Shakespeare. There is no way of decrypting them, only of finding a string that incidentally results in the same hash. How much computing power you need to find such a value is a measure for the quality of the hash.

To get the original values back from such a hash, you need to keep a lookup table with original value and hash.

GPatel
Pyrite | Level 9
Thank you all, for your comments and suggestions to my question.

Regards,
GPatel

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
How to Concatenate Values

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.

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
  • 3 replies
  • 3118 views
  • 2 likes
  • 3 in conversation