To understand why Narrative requires hashed identifiers rather than raw PII, see Data Pseudonymization.
Prerequisites
Before you begin, ensure you have:- Your ID list saved as a single-column CSV file
- Access to one of the following: Google Sheets, a command line terminal, or the Touchless PII Hasher app
Choose your method
Hashing email addresses
Pre-formatting requirements
Hash functions are case-sensitive and whitespace-sensitive. Before hashing, you must normalize your email addresses:
The Gmail rules apply to
gmail.com and googlemail.com addresses only. Leave periods and + aliases in every other address. This matches NORMALIZE_EMAIL.
Supported hash algorithms
Narrative supports three hash algorithms. For maximum correspondence with other datasets, we recommend generating all three:Method 1: Touchless PII Hasher (fastest)
The Touchless PII Hasher is a free web app that handles formatting and hashing automatically. Your data never leaves your browser.1
Open the app
Navigate to narrative.io/touchless-pii-hasher.
2
Upload your file
Drag and drop your CSV file or click to browse.
3
Download the results
The app automatically formats and hashes your data. Download the resulting file.
Method 2: Google Sheets (small lists)
For lists under 10,000 rows, use Narrative’s Hashing Functions spreadsheet which automatically handles pre-formatting and all three hash algorithms.1
Make a copy of the template
Open the Hashing Functions spreadsheet and click Make a copy when prompted.
2
Paste your email list
Copy your list of emails and paste them starting in cell A4.
3
Wait for processing
The spreadsheet may take a few minutes to compute, depending on list size.
4
Download the results
Navigate to the tab titled DOWNLOAD_THIS_SHEET_AS_.CSV_FILE. Go to File > Download > Comma-separated values (.csv, current sheet).
Method 3: Command line (large lists)
For large lists or automation, use the command line. Narrative provides a hashing script, or you can use standard Unix tools.- Mac/Linux
- Windows (PowerShell)
Option A: Use Narrative’s hashing scriptOption B: Use standard Unix toolsFor a quick one-liner that handles pre-formatting and generates SHA-256 hashes:To generate all three hash formats:
1
Download the script
Download hashingFunction.py and save it to your
~/bin directory.2
Make it executable
3
Run the script
Hashing phone numbers
Phone numbers follow a similar process, but with different pre-formatting rules. Narrative matches phone numbers by SHA-256 only, and which attribute a hash matches depends on exactly what you hashed.Pre-formatting requirements
Write every number in E.164 format: a+, the country code, then the national number, with nothing else.
A leading
0 is a trunk prefix, not part of the number, and the country can’t be told from the number alone. Convert national numbers with the country they belong to; don’t guess it.
Which attribute your hash matches
Hash the E.164 number with the
+ unless your partner expects one of the other forms. If your numbers are already in Narrative as plain text, you don’t need to hash them: map the column to telephone_number, and Narrative derives all three hashes for numbers written with a +. NQL’s NORMALIZE_PHONE converts national numbers when you know their country.
Using Google Sheets for phone numbers
Use Narrative’s Phone Hashing Functions spreadsheet. It strips every non-numeric character, the+ included, so its SHA-256 hashes are MSISDN hashes: map them as sha256_hashed_msisdn.
Follow the same steps as email hashing above.
Using command line for phone numbers
These commands expect numbers that already carry their country code. They keep the+ and the digits, drop everything else, and output the SHA-256 hash.
- Mac/Linux
- Windows (PowerShell)
Verify your output
Before uploading, verify your hashing is correct using this test data: Test email:[email protected]
Test phone number:
+15551234567
If your hashes match, your implementation is correct.
Uploading your hashed list
Once your list is hashed:- Ensure your file is in CSV format
- Navigate to your dataset in Narrative
- Upload the hashed file
Troubleshooting
Related content
Data Pseudonymization
Understand why Narrative requires hashed identifiers
Touchless PII Hasher
Free web app for quick, secure hashing
Security Model
Learn how Narrative protects your data

