6 ms·
Having a very simple API is not at odds with security, though. A simple API could automatically seed from the OS and then run a tiny loop with sha2 or sha3, fo
by Dylan16807 7y ago
Having a very simple API is not at odds with security, though. A simple API could automatically seed from the OS and then run a tiny loop with sha2 or sha3, for example.
- vunie 7y agoSHA2 is not designed to be used as a RNG. SHA3 might be a little bit better with its "streaming" modes, but there are many far better and faster ways to get random bits.
- Dylan16807 7y agoIt doesn't have to be the absolute fastest, it just has to work. What is far better and faster than SHA3? And while SHA2 wasn't designed for that use, it's easy to make simple and provably correct constructs that turn a secure hash into a secure RNG.
- heavenlyblue 7y agoYou’re speculating to prove a point. I would definitely not want my std to be designed this way.
- Dylan16807 7y ago1. It was just an example. 2. You definitely don't want your std to be designed with a simple API to a fast, secure, and popular crypto primitive? Pretend I named your favorite one, to avoid bikeshedding issues.
- edflsafoiewq 7y agoChaCha20 is widely used for CSRNG.
- Dylan16807 7y agoAgreed, that would work fine. But for a generic RNG function, I feel like the difference between 3 and 7 cycles per byte isn't too impactful.