by hinkley · 2y ago · 0 comments
You can send half-random input in and then send more half-random input in until you’re satisfied that the RNG has gotten a suitable amount of entropy. Do not chop, rearrange, hash, or bit shift the data trying to make it “stronger” the CSPRNG will do an infinitely better job of doing that for you. Just treat it like a Mr Fusion. Drop a can, a banana peel and the stale beer in and let it cook.
I gave a similar speech to a team trying to initialize SSL sessions on an embedded machine. “But what if we XOR…” No. Stahp.
Just poke in the setSeed function and see what it does.
Why are you equating that to a hacky attempt to make less random data more random?
Another responder suggested that the mention of v6 UUIDs is an error. Maybe. But that’s a truly bizarre typo to make. And they still haven’t fixed it.
setSeed(0); setSeed(1); rand()
and
setSeed(1); rand()
returning different values is not only a good idea but is already a thing. Am I wrong?
This would confuse the hell out of me, what specifically has this behaviour?
Adding entropy is a very different operation.
This does not actually work. If an attacker can observe output of the CSPRNG, and knows the initial state (when it did not yet have enough entropy), then piecemeal addition of entropy allows the attacker to bruteforce what the added entropy was. To be safe, you need to add a significant amount of entropy at once, without allowing the attacker to observe output from an intermediate state. But after you've done that, you won't ever need to add entropy again.
GP does not suggest using the output before enough entropy had been gathered, eg see ‘until’ in:
> until you’re satisfied that the RNG has gotten a suitable amount of entropy.