Skip to main content

Hashing Identifiers

LiveRamp accepts the following hashed identifiers and hashing types:

  • Email addresses: SHA-256, MD5, or SHA-1 hashes

  • Phone numbers: SHA-1 hashes (EU data files cannot contain hashed phone numbers)

  • Mobile device IDs: SHA-1 hashes

Note

  • LiveRamp cannot accept hashed name and postal address data. Unfortunately, there is too much variation in casing and whitespace to do this reliably.

  • Before hashing, be sure to UTF-8 encode the string.

  • When sending hashed identifiers, include the hash type in the column header, such as “EMAIL1_SHA-1”.

  • See the "Hashing Examples" section below for specific instructions and examples.

LiveRamp accepts SHA-256, MD5, or SHA-1 hashed email addresses.

Convert all characters to lowercase, remove all whitespace, and perform UTF-8 encoding on the string before hashing. For example, the plaintext email address "MyName@liveramp.com " must be changed to "myname@liveramp.com" before hashing.

Caution

Make sure to check that your hashing algorithm produces the results for email address hashing produced in the “Hashing Examples” section of this document. Hashing algorithms that put a “0x” at the beginning of the hash string will result in the file upload failing.

Note

Your match rates may be slightly lower with hashed email addresses than with plaintext emails. To maximize the match rates for hashed email addresses, send all three hash types, each in a separate column.

LiveRamp accepts SHA-1 hashed phone numbers. Remove all country extensions, parentheses, and hyphens and then perform UTF-8 encoding on the string before hashing.

For example, if the input phone number is "+1 (555) 123-4567", convert that to "5551234567" before hashing.

Warning

EU data files cannot contain hashed phone numbers.

LiveRamp accepts SHA-1 hashed mobile device IDs.

Before hashing:

  • AAIDs must be downcased and hyphenated

  • IDFAs must be upcased and hyphenated

  • Perform UTF-8 encoding on the string

Caution

Hashed AAID IDs and hashed IDFA IDs cannot be accepted in the same file. To send both types of hashed mobile device IDs, put them in separate files.

MD5 Hashing in Python

The following code snippet shows an example of how to perform an MD5 hash of an email address in Python.

# Import hashing library
import hashlib
# The input email has capital letters and a space at the end.
input_email = "IMeyers@liveramp.com "
# The input email address is downcased and ALL whitespace (not only spaces) is removed.
hashed_email = hashlib.md5(''.join(input_email.lower().split())).hexdigest()

SHA-1 Hashing in Ruby

The following code snippet shows an example of how to perform a SHA-1 hash of an email address in Ruby.

# Load the Digest module
require 'digest'

email_to_hash = 'liveramp@example.com'

# Get the hex-encoded hash value (a.k.a. digest value) of the email address
# after stripping leading and trailing white space and replacing all uppercase
# letters with their lowercase counterparts.
Digest::SHA1.hexdigest(email_to_hash.strip.downcase)
#=> "91ac4ee2ca1782581f12d865a6779eb179f8b22a"

SHA-1 Hashing in Python

The following code snippet shows an example of how to perform an SHA-1 hash on a phone number in Python.

import hashlib

# A phone number in the correct format
input_phone = "4159870604"

# SHA-1 hash the phone number
hashed_phone = hashlib.sha1(input_phone).hexdigest()

Other Hashing Examples

There are JavaScript libraries available that can perform SHA-1 hashes—for example, this one from Google.