News for hackers. Stuff that matters.
Re:Ask HN: We just had an actual UUID v4 collision... by jandrewrogers on Friday May 08, 2026 @02:00PM (#48066613)
In high-reliability systems a criterion for identifier design is easy detection of defective identifiers. This includes buggy systems and adversarial manipulation.

The problem with UUIDs that rely on entropy sources is that it is computationally expensive to detect if the statistical distribution of identifiers is diverging from what you would expect from a random oracle. I've written systems that can detect entropy source anomalies but you'll want to turn it off in production.

It is pretty cheap to sanity check most non-probabilistic identifier schemes. UUIDs that use broken hash algorithms (e.g. UUIDv3/5) or leak state (e.g. UUIDv7) are exposed to adversarial exploitation.

The identifier scheme is dependent on the use case. Does the uniqueness constraint apply to the instance of the object or the contents of the object? Is the generation of identifiers federated across untrusted nodes? How large is the potential universe of identifiers?

The basic scheme I've seen is a 128-bit structured value that has no probabilistic component. These identifiers can be encrypted with AES-128 when exported to the public, guaranteeing uniqueness while leaking no internal state. The benefit of this scheme is that it is usually drop-in compatible with standard UUID even though it is technically not a UUID and the internal structure can carry useful metadata about the identifier if you can decrypt it.

Federated generation across untrusted nodes requires a more complex scheme, particularly if the universe of identifiers is extremely large. These intrinsically have a collision risk regardless of how the identifiers are generated.

All of the standardized UUID really weren't designed with the requirements of scalable high-reliability systems in mind. They were optimized for convenience and expedience which is a perfectly reasonable objective. Most people don't need an identifier system engineered for extreme reliability, even though there is relatively little cost to having one.

Re:Ask HN: We just had an actual UUID v4 collision... by eaf7e281 on Friday May 08, 2026 @03:36PM (#48067700)
> leak state (e.g. UUIDv7)

But according to PostgreSQL, UUIDv7 provides better performance in the database, so is this essentially a trade off between security and speed?

Re:Ask HN: We just had an actual UUID v4 collision... by jubilanti on Friday May 08, 2026 @03:48PM (#48067841)
Yes, because UUIDv7 gives up some random bits in order to include the timestamp, which is done in a way that makes UUIDv7s quick to sort by timestamp.
Re:Ask HN: We just had an actual UUID v4 collision... by ai_slop_hater on Friday May 08, 2026 @05:53PM (#48069246)
How does including the timestamp expose me to adversarial exploitation?
Re:Ask HN: We just had an actual UUID v4 collision... by goalieca on Friday May 08, 2026 @08:10PM (#48070331)
I’ve not come across any.
Re:Ask HN: We just had an actual UUID v4 collision... by danpalmer on Friday May 08, 2026 @07:56PM (#48070240)
It reveals the time you created the UUID, for one. That can lead to a bunch of problems.
Re:Ask HN: We just had an actual UUID v4 collision... by devmor on Saturday May 09, 2026 @09:16AM (#48074747)
The same way using an auto increment integer ID does, but imagine that integer also leaked your created timestamp column too.
Re:Ask HN: We just had an actual UUID v4 collision... by dchest on Saturday May 09, 2026 @08:57AM (#48074631)
How does a high-reliability system have a broken /dev/random? You're better off fixing it rather than trying to fix every downstream component that uses it. You can put your AES-128 counter there if you can count reliably.