News for hackers. Stuff that matters.
Re:Should random() be banned? by hombre_fatal on Thursday February 11, 2021 @09:27PM (#26110137)
Not sure what you have in mind when you say guids, but the word guid doesn't confer any info here. Most people are referring to uuids when they say guid, and a v4 uuid has 122 bits of randomness. A random 122 bit number can certainly be sufficient for most applications like api keys over the network.
Re:Should random() be banned? by matthewdgreen on Thursday February 11, 2021 @09:42PM (#26110198)
Some standard uuid libraries have weird not-very-random fallbacks when the RNG fails to initialize. It’s rare, but you can get strange stuff without realizing it. Better to use a real RNG and check error codes.
Re:Should random() be banned? by hombre_fatal on Friday February 12, 2021 @05:07AM (#26112085)
Yep, there's no rule of thumb that can spare you from reading the docs and knowing basic things about the code you're about to pull in.
Re:Should random() be banned? by adrr on Thursday February 11, 2021 @09:51PM (#26110252)
Guids is uuid and they can be interchanged but they all have same concept of creating unique identifiers that won’t ever collide.

It isn’t random is the problem and they are are used everywhere as a secret. People think they are random 122bit value.

Re:Should random() be banned? by Dylan16807 on Thursday February 11, 2021 @09:57PM (#26110286)
No, that's why you need to be specific. v4 is random, other versions aren't.
Re:Should random() be banned? by adrr on Thursday February 11, 2021 @09:59PM (#26110304)
You’re right I’d just looked at the rail implementation. I was basing it on my past knowledge of windows GUID implementation.