5 ms·
Also: if someone is working on crypto and doesn't know that random() isn't true random, should they be working on that?
by FalconSensei 6y ago
Also: if someone is working on crypto and doesn't know that random() isn't true random, should they be working on that?
- JauntyHatAngle 6y agoThe level of expertise far outstrips the demand in my experience, so the "should" often becomes moot.
- aaomidi 6y agoThere isn't a threshold where you become capable of working on crypto problems and code. Making this safer makes mistakes far less likely and makes all of us safer.
- bigiain 6y agoI disagree. Making one specific aspect of incompetent crypto coding “safer” doesn’t solve any of the problems. We can argue about what threshold you need to reach to be considered “capable” of writing crypto code (that’s not just a learning exercise), but not knowing the deficiencies of random() is clearly well below that bar. Even knowing that is barely past the “don’t eat your crayons” level of skill. If anything, a hook in your CI pipeline that automatically fires anybody who checks in code using random() in a cryptographic context is a better way to “make all of us safer”.
- aaomidi 6y agoYou could be a great mathematician and not realize what kind of random you're picking. It's not as simple as you put it. This discussion goes for other stuff too. Rust is getting popular because even amazing C and C++ devs make terrible mistakes that cause severe security and privacy problems down the line.
- thekyle 6y agoJust because someone is a great mathematician does not mean they would be a great cryptographer. Mathematics and cryptography are about as related as computer science and cryptography (not that much).
- adrr 6y agoI’ve seen guids used as secrets on APIs/cookies. Those are easily guessable and also not random.
- hombre_fatal 6y agoNot 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.
- matthewdgreen 6y agoSome 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.
- hombre_fatal 6y agoYep, 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.
- adrr 6y agoGuids 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.
- Dylan16807 6y agoNo, that's why you need to be specific. v4 is random, other versions aren't.
- adrr 6y ago
- lucideer 6y ago> should they be This is the point of people suggesting things like bans or explicit warnings. They "shouldn't", but what's stopping them.