logoalt Hacker News

beardywtoday at 8:30 AM3 repliesview on HN

Just a stupid question, but why not append the date, even in seconds as hex. It's just a few bytes and would guarantee that everything OK now will be OK in the future?


Replies

flohofwoetoday at 9:03 AM

You can just use a different UUID variant which includes timestamp data instead (e.g. v1 or v7), there are also variants which include the MAC address.

pan69today at 9:39 AM

> but why not append the date

And use uuid v5 to hash it :)

mittermayrtoday at 8:35 AM

yeah, any sort of additional semi-random data could've helped prevent this, I'm sure. That, however, is also kind of the idea of UUIDv4, it has lots of randomness and time built in already.

show 1 reply