Published on 3 December 2025

Every time IDs are discussed on Hacker News, someone suggests encrypting them instead of using public-facing UUIDv7 or other alternatives. This sounds clever. It’s not.

The Problem

Sequential IDs leak information. They are subject to the "German tank problem", allowing attackers to estimate the number of records and guess valid IDs to access resources.

You switch to UUIDv4: Random, unpredictable, and pretty standard. Except your database suffers: random IDs destroy index locality and make your DB lookups slow.

You switch to UUIDv7: Sortable, thus DB-friendly. But the timestamp is embedded. If you can tolerate disclosing creation time, you’ve solved the problem and you’re done.

The Bad Solution: Encrypt Your IDs

Some people see the times…

Similar Posts

Loading similar posts...

Keyboard Shortcuts

Navigation
Next / previous item
j/k
Open post
oorEnter
Preview post
v
Post Actions
Love post
a
Like post
l
Dislike post
d
Undo reaction
u
Recommendations
Add interest / feed
Enter
Not interested
x
Go to
Home
gh
Interests
gi
Feeds
gf
Likes
gl
History
gy
Changelog
gc
Settings
gs
Browse
gb
Search
/
General
Show this help
?
Submit feedback
!
Close modal / unfocus
Esc

Press ? anytime to show this help