How It Works

This tool generates a deterministic, de-identified 10-digit numeric patient ID from a patient's name. The same name and salt will always produce the same ID, but the ID cannot be reversed back to the name.

Step 1: You Enter the Data

You provide three things for each patient: their last name, first name, and optionally their middle name. You also provide a salt, a secret string that acts as a password for the ID generation.

Step 2: Name Assembly

The three name fields are combined into a single string in the format:

Last, First Middle

If no middle name is provided, it becomes simply:

Last, First

Before assembly, each field is cleaned up: leading and trailing spaces are removed, and any runs of multiple spaces within a field are collapsed down to a single space. This means " Jane " and "Jane" produce the same result.

Step 3: Final Cleaning

The assembled name string then has all whitespace and all commas stripped out entirely. For example:

Assembled:Smith, Jane Marie
After cleaning:SmithJaneMarie

This is important: case is preserved and matters. Smith and smith will produce different IDs. Hyphens in names (like Davis-Jones) are also preserved and included in the hash.

Step 4: Salt is Prepended

The secret salt string is placed before the cleaned name. If your salt is MySecret and the cleaned name is SmithJaneMarie, the string that gets hashed is:

MySecretSmithJaneMarie

The salt is used exactly as you type it. It is case-sensitive, and spaces within the salt are preserved. Everyone generating IDs for the same study must use the exact same salt to get matching IDs.

Step 5: SHA-256 Hashing

The combined string is fed into the SHA-256 cryptographic hash function. This produces a 64-character hexadecimal string (256 bits). SHA-256 is a one-way function. You cannot reverse the hash to recover the original name.

The hex output is then converted into a very large integer (up to 78 digits long).

Step 6: Truncation to 10 Digits

The first 10 digits of that integer are taken as the patient ID. This is a simple string slice of the number: no rounding or math, just the leftmost 10 digits.

Full integer:1079502049865113190095...
Patient ID:1079502049

Summary of What Affects the ID

Changes the ID:
  • Different spelling of any part of the name
  • Different capitalization (e.g. "jane" vs "Jane")
  • Different salt
  • Adding or removing a middle name
  • Adding or removing a hyphen in the last name
Does NOT change the ID:
  • Extra spaces before, after, or within a name field
  • Extra commas (they are stripped)
  • Which field the comma is typed into (they are stripped)

Privacy

All processing happens entirely in your browser using the Web Crypto API. No patient names, no salt, and no generated IDs are ever sent to a server. Nothing is stored after you close or refresh the page.