Do Not Encrypt IDs
notnotp.com·2h·
Discuss: Hacker News
🔐Cryptographic Archaeology
Preview
Report Post

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...