Skip to main content

Hashing sensitive data

Rokt is aware of the importance and sensitivity of your personally identifiable information (PII) and takes care to preserve the confidentiality and security of your customer data.

To avoid the transmission of sensitive data, Rokt provides tools and instructions on how to cryptographically hash your PII before you send it to us for suppression, segmentation, or conversion analysis.

To get started, you just need a list with the customer data you'd like to hash, such as subscriber email addresses.

What is hashing?

Cryptographic hashes are functions that convert your data to a mix of numbers and letters which is practically impossible to reverse. They’re easy to generate, difficult to decipher, and unique for each value you hash. For example, slightly changing an email address generates a completely different hash value.

Rokt does not need to decipher these hashes, as we are only looking for your customers who have already engaged with the Rokt platform, or will engage in the future. When customers consent to providing their data, we hash it ourselves. This is how we find matches between our customers and yours.

Preparing your file

Once something is hashed, it’s difficult to determine if it worked successfully, so ensuring you’ve prepared the file correctly is very important.

Create your file of email addresses in the following format (for both Mac and PC) to ensure that there are no problems when hashing:

  • Create a text (*.txt) file in Windows Formatted Text (.txt) format.

  • Include only the email addresses of your customers. This is the only field Rokt currently uses to identify customers on the network.

  • All email addresses have to be lowercased.

  • Place each email address on new line. Do not include commas, semicolons, or other special characters to separate them.

  • Ensure there are no leading or trailing spaces around your email addresses.

  • Ensure there is no empty line at the bottom of the file.

  • Save your file on your desktop or other easily accessible location (especially for Mac users).

Hashing on Windows

For computers running Windows, you will need to download and use an executable file that Rokt has produced. You may need administrator privileges on your device to run this application, depending on your version of Windows.

  1. Download and open RoktAppsHashTool.exe. This application only runs on Windows. You may be prompted by a security message to confirm that you would like to run the application, depending on the Windows version you are running. Allow the application to continue.
  2. From the hashing application, click Select a file from your computer and choose the file that you have prepared according to the instructions above.
  3. Select the format that you want to hash your emails in. Choose SHA256. These are the only hashing algorithms that Rokt currently supports. Unless you have a preference, it does not matter which one you choose.
  4. Click Select the output file and you can choose where you want to save the output file.
  5. Click Hash File. Depending on the size of your file, this may take a while to process. You can see the progress of the hashing process as you wait.
  6. When it is finished, you can find the file in the destination that you selected above. The file name will be the original file name that you chose to upload, but with a .SHA256 file extension instead of .txt, depending on the hash type that you chose.
  7. If you would like to double-check, you can right-click the output file and open with Notepad or a similar program to see your hashed values.

Your file is now ready to transmit to Rokt safely and securely.

Hashing on MacOS

You will require MacOS X 10.10 (Yosemite) or higher to perform this function. Note: Do not copy the commands below; enter them into terminal yourself.

  1. Open Spotlight, search for Terminal and open the application.
  2. From Terminal, navigate to where your raw file is saved, by typing:
cd {File Location}

Example:

cd Desktop 

Last login: Fri Dec 25 12:02:37 on ttys001
ROKT-mbp: ~ roktuser$ cd Desktop
  1. Press Enter. If successful, Terminal returns your file location.
ROKT-mbp: ~ roktuser$ cd Desktop 
ROKT-mbp: roktuser Desktop$
  1. Instruct the Terminal to get rid of invisible characters that will affect the hashing process
tr -d '\r'  < {FileName} > {Desired Output File name}

Example:

tr -d '\r' < roktemails.txt > roktemailscleaned.txt
Last login: Fri Dec 25 12:02:40 on ttys001

ROKT-mbp: ~ roktuser$ cd Desktop Is roktemails.txt

ROKT-mbp: Desktop roktuser$ tr -d '\r' < roktemails.txt > roktemailscleaned.txt
  1. Press Enter. If successful, Terminal returns your file location and your user name on a new line.
Last login: Fri Dec   25 12:02:40 on ttys001
ROKT-mbp: ~ roktuser$ cd Desktop Is roktemails.txt
ROKT-mbp: Desktop roktuser$ tr -d '\r' < roktemails.txt > roktemailscleaned.txt
ROKT-mbp: Desktop roktuser$
  1. Instruct Terminal to hash the file that you just cleaned using the SHA256 hash function, by typing:
cat {File Name} | while read -r line || [[ -n "$line" ]]; do printf '%s\n' "$line" | tr -cd '[:print:]' | shasum -a 256 | awk '{gsub(/[[:space:]]+$/, ""); print $1}'; done > {Desired Output File name}

Example:

cat roktemailscleaned.txt | while read -r line || [[ -n "$line" ]]; do printf '%s\n' "$line" | tr -cd '[:print:]' | shasum -a 256 | awk '{gsub(/[[:space:]]+$/, ""); print $1}'; done > roktemailscleanedandhashed.txt
Last login: Fri Dec 25 12:02:40 on ttys001

ROKT-mbp: ~ roktuser$ cd Desktop Is roktemails.txt
ROKT-mbp: Desktop roktuser$ tr -d '\r' < roktemails.txt > roktemailscleaned.txt
ROKT-mbp: Desktop roktuser$ shasum -a 256 roktemailscleaned.txt | cut -d " " -f 1 > roktemailscleanedandhashed.txt
  1. Press Enter. The selected file starts processing.
Last login: Fri Dec   25 12:02:40 on ttys001
ROKT-mbp: ~ roktuser$ cd Desktop Is roktemails.txt
ROKT-mbp: Desktop roktuser$ tr -d '\r' < roktemails.txt > roktemailscleaned.txt
ROKT-mbp: Desktop roktuser$ shasum -a 256 roktemailscleaned.txt | cut -d " " -f 1 > roktemailscleanedandhashed.txt
ROKT-mbp: Desktop roktuser$
  1. Do not close Terminal while it is processing or progress will stop. This may take a while depending on the size of your file.
  2. Your file will then be generated in the same folder that you have specified in step 2.

Mac troubleshooting

How do I specify the location of my file if it’s in a sub-folder?

If you have saved your file in a subfolder or subdirectory and do not want to move it, you need to specify the location of the file using the folder hierarchy, separated by forward slashes. You would indicate the folders you would need to click to access that file.

Example:

cd Desktop/RussianDolls/BigDolls/MediumDoll/SmallDoll Is roktemail.txt

Why is it telling me "No such file or directory" when I try to locate a file?

There are a few reasons this could happen:

  • The file does not exist in the folder you specified
  • The file name is misspelled
  • A folder name is misspelled
  • You opened the terminal before the file was in the location that you specified

How can I tell if the process is still running so that I can close Terminal?

You can tell if the process is still running by looking at the top of the Terminal window. The name of the window will read:

{File Location} - bash - {Pixel} x {Pixel}

(where Pixel refers to the width and height of the Terminal window)

While the process is still running, the word bash will quickly switch back-and-forth between bash and shasum. Alternatively, if you try to close the Terminal window while the process is still running, you are asked to confirm as there is a process still running. You won't get this notification if the process has finished.

Was this article helpful?