<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to encrypt ID in the dataset[] in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-encrypt-ID-in-the-dataset/m-p/886522#M350301</link>
    <description>&lt;P&gt;You can use the MD5 hashing function. Use the $HEX32. format to make the resulting 16-byte value readable.&lt;/P&gt;</description>
    <pubDate>Wed, 26 Jul 2023 19:04:26 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2023-07-26T19:04:26Z</dc:date>
    <item>
      <title>How to encrypt ID in the dataset[]</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-encrypt-ID-in-the-dataset/m-p/886486#M350285</link>
      <description>&lt;P&gt;Hi, I've two datasets with a list of IDs. For privacy reasons I need to have them encrypted so as to share the data with other users and they can then use the encrypted ID to link&amp;nbsp; between each other. Any suggestions?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The variable ID has 10-digit character values. Thanks in advance.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have; input id $ 1-10;
datalines;
0000352342
0029559722
0842397036
1129250328
2920541415
3466466703
4024548491
5229643020
6154709322
7498284887
8258157100
9052514674
9611158863
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 26 Jul 2023 16:56:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-encrypt-ID-in-the-dataset/m-p/886486#M350285</guid>
      <dc:creator>Solph</dc:creator>
      <dc:date>2023-07-26T16:56:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to encrypt ID in the dataset[]</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-encrypt-ID-in-the-dataset/m-p/886522#M350301</link>
      <description>&lt;P&gt;You can use the MD5 hashing function. Use the $HEX32. format to make the resulting 16-byte value readable.&lt;/P&gt;</description>
      <pubDate>Wed, 26 Jul 2023 19:04:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-encrypt-ID-in-the-dataset/m-p/886522#M350301</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2023-07-26T19:04:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to encrypt ID in the dataset[]</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-encrypt-ID-in-the-dataset/m-p/886554#M350314</link>
      <description>&lt;P&gt;Thanks a lot. Just a few questions though.&lt;/P&gt;
&lt;P&gt;1. Would people who receive the data be able to reverse and find out the original value of ID?&lt;/P&gt;
&lt;P&gt;2. If I would always get the same set of encrypted values running this code? Is it possible to vary? So different recipients of the data would have ID encrypted differently?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want; set have;
Encrypted_ID = put(md5(id),$hex32.);
run;&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;ID&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;  Encrypted_ID&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;0000352342 DD392A830FAC59CD8B6EE0F091D4DB4A&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;0029559722 0AA9AB1440D9057354E5451BDFB6C690&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;0842397036 EAC6A4A7F880A7169F4FBCBC86BFC175&lt;BR /&gt;...&lt;/CODE&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 26 Jul 2023 23:57:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-encrypt-ID-in-the-dataset/m-p/886554#M350314</guid>
      <dc:creator>Solph</dc:creator>
      <dc:date>2023-07-26T23:57:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to encrypt ID in the dataset[]</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-encrypt-ID-in-the-dataset/m-p/886557#M350315</link>
      <description>&lt;P&gt;MD5 is not encryption but encoding. The same source value will always return the same encoded value. ...It's not impossible but very hard to revert the encoded value back to a clear text value.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Just concatenate something user specific to the source string to create different sets of encoded values.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data sample;
  clear_text='12345';
  length digest_1 digest_2 $32;
  digest_1=hashing('md5',catx('|','user1',clear_text));
  digest_2=hashing('md5',catx('|','user2',clear_text));
run;

proc print data=sample;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Patrick_1-1690418585023.png" style="width: 599px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/86158i447C95BC0CDB6201/image-dimensions/599x62?v=v2" width="599" height="62" role="button" title="Patrick_1-1690418585023.png" alt="Patrick_1-1690418585023.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Jul 2023 00:43:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-encrypt-ID-in-the-dataset/m-p/886557#M350315</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2023-07-27T00:43:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to encrypt ID in the dataset[]</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-encrypt-ID-in-the-dataset/m-p/886578#M350325</link>
      <description>&lt;P&gt;MD5 will always result in the same hash for the same source.&lt;/P&gt;
&lt;P&gt;Since it gives a finite number of results (2^128) for any kind of input, it is not reversible. Given some parameters for the source, though (like length 10 and "only digits"), one can easily create a reference table for all the 10^10 possible sources.&lt;/P&gt;</description>
      <pubDate>Thu, 27 Jul 2023 06:26:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-encrypt-ID-in-the-dataset/m-p/886578#M350325</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2023-07-27T06:26:39Z</dc:date>
    </item>
  </channel>
</rss>

