Hacker News new | ask | show | jobs
by deathanatos 1134 days ago
Hopefully you're setting the appropriate bits. A UUID is a bit-packed struct/union at heart, really; if you're just reading 128-bits of random data from /dev/random, that's not a UUID; passing it off as such would be needlessly confusing.

(It's fine to make a new format / it's not terrible approach for making a random ident, though you might want to peek into, e.g., ksuid from the OP for some interesting points about why you might not want to do that, plus some advice about getrandom() over /dev/random.)

2 comments

The systemd developers made the same mistake initially. They later corrected it, and forced the non-random fields to the correct values.
If you treat them as opaque strings and don't use their binary representation, you'll be fine.