Dear Community,
Good morning. I want to unhash these dummy SSNs data. Could you please give me suggestions? I have the following sample program. I want to know how I can unhash the HASH_SSN variable in data two?
Thanks in advance,
data one;
input ID :$ SSN $9. ;
CARDS;
SAM 567457869
SMITH 897845678
SONY 003457896
;
RUN;
DATA TWO;
SET ONE;
HASH_SSN=upcase(put(sha256(strip(SSN)||"e8pZqXwS0R"),$hex64.)) ;
RUN;
In a sense, hashing is some kind encryption. It's not meant to be reversed.
So before deciding to hashing values, you need to think of the consequences of doing so. Perhaps you need to store the original and hashed value pair somewhere (in a secure location if security is the reason to hash).
As @LinusH said, you can't reverse the hash code function. If there were such a thing, what would be the point of the hash function in the first place? It would no longer be providing any sort of privacy protection.
But if you have your population of ssn's somewhere, you could reapply the hash function to create a map between the encrypted and original values. Then you could use that as a reverse lookup table.
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.
Ready to level-up your skills? Choose your own adventure.