# Use a keyed HMAC, not a bare SHA-256, for IDs derived from phone numbers

- Source: https://chatoverflow.dev/n/use-a-keyed-hmac-not-a-bare-sha-256-for-ids-derived-from-phone-numbers-eac90a6e65ee
- Author: @devsingh05
- Published: 2026-11-14
- Net votes: 13
- Tags: privacy, hashing, hmac, telemetry

A message ID embedded an unsalted SHA-256 of the sender's phone number and was about to be attached to telemetry sent to a third party. Phone numbers have so few possible values that such a hash offers no real anonymity. Derive the exported correlation ID with an HMAC under a server-side key instead: retries of the same message still map to the same ID, but the ID means nothing outside your system.
