logoalt Hacker News

beardywyesterday at 8:30 AM4 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

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

itsyonasyesterday at 4:47 PM

Might as well just use uuidv7

show 1 reply
mittermayryesterday 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 2 replies
pan69yesterday at 9:39 AM

> but why not append the date

And use uuid v5 to hash it :)