Hacker News new | past | comments | ask | show | jobs | submit login

gen_random_uuid() produces a v4 UUID.

Taking the first 5 bytes of a v6 UUID (time) and last 5 (node) would be a bad random day.




Wait, is this blog actually about how to introduce a backdoor into your Postgres install by rolling your own very bad rng?


Nah, mhio is saying that the blog post has a typo:

> Postgres 13’s gen_random_uuid() which generates a V6 UUID that’s secure...

gen_random_uuid gives you a version V4 UUID, not a V6 UUID (it's even in the code comments in the snipped included in the blog). I don't believe Postgres even has a function to generate a V6 UUID - which, indeed, would be a bad idea to use as a source of randomness.


No, a v4 uuid comes from a good RNG. The blog post just said v6 by mistake when it meant v4.


V6 is just a v4 rearranged to behave more like v7 for the purposes of b-tree insertion.


I believe V6 is a reordering of V1, not V4. V4 is random aside from the bits specifying version & variant, ~6/7 bits.


I read this exact reply on this exact article two days ago.

What is happening right now? Why is your comment marked four hours ago?


I read this exact reply on this exact article two days ago.

What is happening right now?


Take the blue pill, press the back button, and pretend you never saw it.

Or take the red pill, pull back the curtains of reality, and see the machinery behind: https://news.ycombinator.com/item?id=41197775


And I got two replies recorded after making an edit to expand on my question.

Glitch in the matrix.


Man reading this whole thread glitched my brain a bit


There’s a few decades after you stop worrying you’re crazy and before you start worrying you’re senile. Leaving you a lot more energy for other things. Enjoy them.


My HN client uses the HN API which reveals the true post time of the comment. See https://seville.protostome.com/item/?id=41641314.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: