Hacker News new | ask | show | jobs
by dheera 2088 days ago
> sortable (time component)

You can easily prepend a unix millisecond timestamp to a UUID if you want time-sortability, i.e.

174e1da9377-d739f4ed-6aa1-4c99-a0bf-3b0b68e9ce77

where 174e1da9377 is a unix timestamp in milliseconds.

> short (26 chars)

Short == increased possibility of a collision. If you're okay with this possibility, you can just use UUIDv4 and truncate it.

> and nearly human readable

Convert your UUID into base26 or whatever you wish for human readbility.

> and good enough entropy/randomness

Subjective, if you are okay with "good enough entropy" you could arguably just use a random string of the number of bits you'd like.

1 comments

This makes a ton more sense than messing with the UUID itself.

Also, for most applications you can just add a timestamp record and sort by that.