UUIDv47
lastmod 2025-09-20created 2025-09-201 edits
Store as UUIDv7 in the database, expose as UUIDv4 externally
About
- UUIDv47 stores sortable UUIDv7 values in the database while exposing values that look like UUIDv4 to external APIs
- XOR-masks only the timestamp field to protect UUIDv7's time information, keeping the remaining random fields as they are
- Masks with a 128-bit key using SipHash-2-4, protecting information securely without risk of key exposure
- encode/decode is deterministic and reversible, and randomness is preserved, so collision risk is low
- Benchmarks show very fast performance; offers a simple integration method and integrates easily with databases such as PostgreSQL
See also
- UUIDv7
- UUIDv4