Expand description
Per-user identity hash used by every broker pipe name.
Returns a 16-character lowercase hex string (the first 8 bytes of a blake3 digest, hex-encoded). Stable across runs for the same user on the same machine; collision resistant in practice.
§Platform inputs
| Platform | Hash input |
|---|---|
| Windows | The current process token user SID, in S-1-... text form, obtained via OpenProcessToken(GetCurrentProcess()) → GetTokenInformation(TokenUser) → ConvertSidToStringSidW. |
| Linux | format!("{uid}:{machine_id}") where machine_id is the contents of /etc/machine-id, falling back to /var/lib/dbus/machine-id. |
| macOS | format!("{uid}:{machine_uuid}") where machine_uuid comes from ioreg -d2 -c IOPlatformExpertDevice (the IOPlatformUUID field). |
§Why a hash?
Pipe-name length limits are tight: Windows MAX_PATH (260) and the
macOS sun_path field (104 bytes). A blake3 16-char hex is short,
collision-resistant for the namespace size we care about
(per-machine per-user), and avoids leaking the literal SID or
machine UUID into world-readable filesystem paths.
Enums§
- SidError
- Errors that can prevent computing the user SID hash.
Functions§
- hash_
to_ 16_ hex - Hash arbitrary bytes to 16 lowercase hex characters using blake3.
- user_
sid_ hash - Return the 16-character lowercase hex blake3 hash of the current user’s platform identity. Stable across runs.