LINA'S SIGN-UP RECORDANALYTICS COPYINTERNETVAULTANALYTICSnameemailbornplancountry1import hmac2KEEP = ("plan", "country")3def for_stats(rec, key):4 out = {f: rec[f] for f in KEEP}5 e = rec["email"].encode()6 h = hmac.new(key, e, "sha256")7 out["uid"] = h.hexdigest()[:12]8 return outplancountryuidNIST PRIVACY FRAMEWORKID-PGV-PCT-PCM-PPR-P
Back row: the person, the key vault, analytics and the attackerMiddle and front: the record, the Python, the analytics copy, the Privacy FrameworkTokens: the form, copied values, the email and key, the stolen copyAt the back: the attacker on the internet, Lina signing up, the key vault and the analytics store. In the middle: Lina's sign-up record. In front: the Python function for_stats(), the small analytics copy it makes, and the five functions of the NIST Privacy Framework. Only plan and country are copied; the email becomes a keyed tag; the record is deleted when the account closes; a later leak of analytics exposes no names, emails or birth dates. A pseudonym is not anonymous. Whoever holds the key can link the tag back to an email, so EU law still treats pseudonymised data as personal data. It lowers the risk; it does not remove it.

Personal data

  1. Personal data is information about a person who can be identified. NIST calls it PII: data that can identify someone alone, like an email, or combined, like a birth date plus a town. Lina signs up to a shop with five fields.

Minimise in Python

When it goes wrong

Compliance

What happens

;; step 1/11 · pii
PII   information that can be used to distinguish
      or trace a person's identity (NIST, OMB A-130)
alone       name, email address
combined    birth date + country + plan ...

rec["name"]       "Lina"
rec["email"]      "lina@x.test"
rec["born"]       "1990-04-12"
rec["plan"]       "pro"
rec["country"]    "KW"

A pseudonym is not anonymous. Whoever holds the key can link the tag back to an email, so EU law still treats pseudonymised data as personal data. It lowers the risk; it does not remove it. The demo key is a short readable string so the example can be checked. A real key is random (for example 32 random bytes for HMAC-SHA-256), comes from a key vault and is never written in code.