I'm doing statistical analysis / data science on productivity data of thousands of employees.

To eliminate the possibility of systematic bias (avoid accidental discrimination), I want to strip out all Personally Identifiable Information (PII). For example, I wouldn't want to be able to see anyone's name, because then my brain would automatically be able to guess at an employee's sex or age or culture.

Here is the challenge, though:

It's often easier to do research (e.g. follow the "story" of how an individual's performance score might be impacted by me altering variables and weights) when each row of data is labeled in a way that is more tangible than just an integer ID or gobbledygook GUID.

So what I'd love is if each row could be labeled not with the full name of the employee but instead with unique phrases like "trunk moon triangle" or "dolphin pancake circus".

Imagine that each employee has a unique integer ID (or some value such as a full name that is somehow guaranteed to be unique that can be replaced by or hashed into a GUID).

What library will let me map an integer ID (or GUID) to a unique phrase (and also works in the reverse direction)?

Requirements (which are probably obvious):

  • The integer should reliably convert into the same unique phrase every time.
  • Each unique phrase must map back to only its one integer.
  • It should be able to handle many IDs (let's say at least 1M, but ideally many more).
  • The words available for each phrase must be only words that would be useful for achieving the goal (so, they must be easy, familiar words, and probably only singular countable non-proper nouns, and no curse words or anything offensive).

I'm asking this question rather than manually building a dictionary of nouns myself and creating an algorithm to convert IDs into phrases of those words because I'd be shocked if a library doesn't already exist that does this beautifully.

P.S. https://stackoverflow.com/questions/4683551/generating-a-pseudo-natural-phrase-from-a-big-integer-in-a-reversible-way is the closest question I found, but its answers don't help.

If there are 1,000 usable, sanitized nouns available somewhere, it won't be super hard to write my own code, and 1000^3 = 1B, so 3-noun phrases would be plenty of permutations. Or 100^4 would be 100M. But I'd still prefer to use a library if there is already a standardized way of solving this problem.


I ended up coding a tool in JavaScript for my employer.

I might eventually be allowed to share here but they have not open-sourced it (yet?).

The general approach is to break the challenge into 2 problems:

  • we want to obfuscate sensitive identifiers (full names or employee IDs)
    • (but we also need to be able to convert them back to the originals, hence using symmetric encryption)
  • we want our new identifiers to be more memorable than integers or gobbledygook (like full names are) to enable better research
    • E.g. we can track outliers in graphs as they move around as we change weights of algorithms
    • We chose to use a dictionary of 23K plant species names

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.