PII normalization, hashing, and encoding

Personally identifiable information (PII) refers to personal data, such as email addresses, phone numbers, credit card numbers, social security numbers, and other types of data that can be used to identify a specific user. For example, Unified ID 2.0 (UID2), a privacy-conscious identity solution, is based on email addresses and phone numbers. See also Unified IDs.

IMPORTANT: This section is for cleaning your PII data and not for creating UID2s. To create a UID2, use UID2 endpoints.

The following sections provide information and examples to help you correctly prepare your PII for uploading to The Trade Desk platform.

Requirements

Here's what you need to know about uploading CRM data to The Trade Desk platform:

TIP: To test the normalization and hashing of email addresses and phone numbers, use the UID2 Hashing Tool. It provides the Base64-encoded value.

Email addresses

Here's what you need to know about uploading email addresses:

Valid input for email addresses

If you're sending email addresses to CRM, the input data must be in one of the formats shown in the following table.

Input Format Instructions
Raw email No action needed. CRM normalizes, hashes, and Base64 encodes.
Normalized email Email address normalization
Normalized, then hashed, then Base64-encoded 1. Email address normalization
2. Email address hashing and encoding

Email address normalization

The platform automatically normalizes uploaded raw email addresses. If you want to hash the email addresses yourself before sending them, you must normalize them before you hash them.

IMPORTANT: Normalization before hashing ensures that the generated ID value will always be the same, and the data can be matched accurately.

Here is some key general information relating to normalization and encoding for UID2:

To normalize an email address, complete the following steps:

  1. Remove leading and trailing spaces.
  2. If there are uppercase characters, convert them to lowercase.
  3. In gmail.com addresses only:
    1. If there is a period (.) in the address (ASCII decimal code 46/UTF-8 hexadecimal code 2E), remove it.

      For example, normalize jane.doe@gmail.com to janedoe@gmail.com.

    2. If there is a plus sign (+) with an additional string after it, before the @gmail.com, remove the plus sign (+) (ASCII decimal code 43/UTF-8 hexadecimal code 2B) and all subsequent characters.

      For example, normalize janedoe+home@gmail.com to janedoe@gmail.com.

IMPORTANT: Make sure that the normalized email is UTF-8, not another encoding system such as UTF-16.

Email address hashing and encoding

An email hash is a Base64-encoded SHA-256 hash of a normalized email address. The email address is first normalized, then hashed using the SHA-256 hashing algorithm, and then the resulting bytes of the hash value are encoded using Base64 encoding. Note that the Base64 encoding is applied to the bytes of the hash value, not the hex-encoded string representation.

The following table shows an example of a simple input phone number, and the result as each step is applied to arrive at a secure, opaque value.

The final value, the hex to Base64 encoded representation of the SHA-256 hash, is the value to provide to the UID2 Operator endpoint.

IMPORTANT: When applying Base64 encoding, be sure to use a function that takes a hex value as input. If you use a function that takes text as input, the result is a longer string which is invalid for the purposes of UID2.

Type Example Comments and Usage
Raw email address USER@example.com None.
Normalized email address user@example.com Normalization is always the first step.
SHA-256 hash of normalized email address b4c9a289323b21a01c3e940f150eb9b8c542587f1abfd8f0e1cc1ffc5e475514 This 64-character string is a hex-encoded representation of the 32-byte SHA-256.
Hex to Base64 SHA-256 encoding of normalized email address tMmiiTI7IaAcPpQPFQ65uMVCWH8av9jw4cwf/F5HVRQ= This 44-character string is a Base64-encoded representation of the 32-byte SHA-256.
IMPORTANT: The SHA-256 hash string in the example above is a hex-encoded representation of the hash value. You must Base64 encode the raw bytes of the hash or use a Base64 encoder that takes a hex-encoded value as input.
IMPORTANT: Use this encoding for email_hash values sent in the request body.

IMPORTANT: When applying Base64 encoding, be sure to Base64 encode the raw bytes of the hash or use a Base64 encoder that takes a hex-encoded value as input.

Normalization examples for email

The following table shows examples of original email addresses and the normalized and hashed values.

Some of the examples show email addresses that include the plus sign (+) with different domains, or the period in the first part of the email (for example, My.Email@example.com). For gmail addresses, the plus sign and following characters, up to the @ sign, are ignored in normalization, and the period in the first part of the email is also ignored. For other domains, these characters are included in the normalized value.

Original Value Processing Steps and Resulting Values
MyEmail@example.com
MYEMAIL@example.com
1. Normalize: myemail@example.com
2. Hash: 16c18d336f0b250f0e2d907452ceb9658a74ecdae8bc94864c23122a72cc27a5
3. Base64 encode: FsGNM28LJQ8OLZB0Us65ZYp07NrovJSGTCMSKnLMJ6U=
My.Email@example.com 1. Normalize: my.email@example.com
2. Hash: e22b53bc6f871274f3a62ab37a3caed7214fc14d676215a96a242fcfada1c81f
3. Base64 encode: 4itTvG+HEnTzpiqzejyu1yFPwU1nYhWpaiQvz62hyB8=
JANESAOIRSE@example.com
JaneSaoirse@example.com
1. Normalize: janesaoirse@example.com
2. Hash: d6670e7a92007f1b5ff785f1fc81e53aa6d3d7bd06bdf5c473cdc7286c284b6d
3. Base64 encode: 1mcOepIAfxtf94Xx/IHlOqbT170GvfXEc83HKGwoS20=
jane.saoirse@example.com
Jane.Saoirse@example.com
1. Normalize: jane.saoirse@example.com
2. Hash: b196432c7b989a2ca91c83799957c515da53e6c13abf20b78fea94f117e90bf8
3. Base64 encode: sZZDLHuYmiypHIN5mVfFFdpT5sE6vyC3j+qU8RfpC/g=
JaneSaoirse+Work@example.com 1. Normalize: janesaoirse+work@example.com
2. Hash: 28aaee4815230cd3b4ebd88c515226550666e91ac019929e3adac3f66c288180
3. Base64 encode: KKruSBUjDNO069iMUVImVQZm6RrAGZKeOtrD9mwogYA=
JANE.SAOIRSE@gmail.com
Jane.Saoirse@gmail.com
JaneSaoirse+Work@gmail.com
1. Normalize: janesaoirse@gmail.com
2. Hash: 92ee26057ed9dea2535d6c8b141d48373932476599196e00352254896db5888f
3. Base64 encode: ku4mBX7Z3qJTXWyLFB1INzkyR2WZGW4ANSJUiW21iI8=

Phone numbers

Here's what you need to know about uploading phone numbers:

Valid input for phone numbers

The platform removes all non-numerical symbols from phone numbers, but cannot normalize to correct values if the country code is missing. Because of this, normalizing phone numbers is always the responsibility of the uploader.

If you're sending phone numbers to CRM, the input data must be in one of the formats shown in the following table.

Input Format Instructions
Normalized, including country code Phone number normalization
Normalized, then hashed, then Base64-encoded 1. Phone number normalization
2. Phone number hashing and encoding

Phone number normalization

Whether you want to upload raw or hashed phone numbers, you must normalize them.

IMPORTANT: Normalization before hashing ensures that the generated ID value will always be the same, and the data can be matched accurately.

Here's what you need to know about phone number normalization requirements:

WARNING: Make sure that the normalized phone number is UTF-8, not another encoding system such as UTF-16.

Phone number hashing and encoding

A phone number hash is a Base64-encoded SHA-256 hash of a normalized phone number. The phone number is first normalized, then hashed using the SHA-256 hashing algorithm, and then the resulting bytes of the hash value are encoded using Base64 encoding. Note that the Base64 encoding is applied to the bytes of the hash value, not the hex-encoded string representation.

The following table shows an example of a simple input phone number, and the result as each step is applied to arrive at a secure, opaque value.

Type Example Comments and Usage
Raw phone number 1 (234) 567-8901 This is the starting point.
Normalized phone number +12345678901 Normalization is always the first step.
SHA-256 hash of normalized phone number 10e6f0b47054a83359477dcb35231db6de5c69fb1816e1a6b98e192de9e5b9ee This 64-character string is a hex-encoded representation of the 32-byte SHA-256.
Hex to Base64 SHA-256 encoding of normalized and hashed phone number EObwtHBUqDNZR33LNSMdtt5cafsYFuGmuY4ZLenlue4= This 44-character string is a Base64-encoded representation of the 32-byte SHA-256.
NOTE: The SHA-256 hash is a hexadecimal value.
IMPORTANT: You must use a Base64 encoder that takes a hex value as input. Use this encoding for phone_hash values sent in the request body.

IMPORTANT: When applying Base64 encoding, be sure to use a function that takes a hex value as input. If you use a function that takes text as input, the result is a longer string which is invalid for the purposes of UID2.

FAQs

Here are some commonly asked questions about PII normalization.

Can I use the data output as a UID?

No. You can call the UID2 API to create a UID. The data outputs in this section here are to normalize, hash, or encode forms of PII data for more data security. The outputs cannot be used as a UID or generate UID Tokens.

Do I have to normalize, hash, and encode PII data when sending it to the platform?

No. You can upload raw data to the platform, and we will normalize, hash, and encode it for you.

Is it safe to send raw data?

Yes. We store PII in a separate, secure domain (called The Trade Desk Secured Environment) only temporarily and immediately delete it after UIDs are created.

What if I don't normalize my data before hashing it?

Not normalizing data before hashing might result in a different IDs. Mismatched data will reduce the effectiveness of targeted advertising.

Do I apply Base64 encoding to the SHA-256-encoded string or the normalized PII?

You must apply Base64 encoding to the raw 32-byte SHA-256 hash of your normalized PII, not to the normalized PII string or the 64-character hex-encoded representation of the SHA-256 hash provided in the examples.

TIP: To test the normalization and hashing of email addresses and phone numbers, use the UID2 Hashing Tool. It provides the Base64-encoded value.