3 ms·
Not really, you can always improve upon an existing PRNG by XOR'ing the random number stream with the output of your own PRNG without thereby weakening security
by jonathanstrange 10y ago
Not really, you can always improve upon an existing PRNG by XOR'ing the random number stream with the output of your own PRNG without thereby weakening security. So if you think /dev/urandom does not produce enough entropy, rolling your own PRNG with additional entropy sources (e.g. mouse movements) on top of it cannot harm if you use XOR for combination.
However, you can also feed the system-wide PRNG with additional entropy, and for many applications this might be the better choice.
- marcosdumay 10y ago> Not really, you can always improve upon an existing PRNG by XOR'ing the random number stream with the output of your own PRNG without thereby weakening security. Unless an attacker gets to acctively control your PRNG results.
- DSMan195276 10y agoI would add, while this is mostly accurate (XOR is perfectly fine for retaining 'randomness' in the sense you're talking about - even if the second stream isn't random the output will still be as random as the initial) there is the big issue that you don't want to accidentally reuse an entropy source. For example, imagine /dev/urandom is already using mouse movements as an entropy source. If you then decide to also use mouse movements, you may have weakened the randomness of the resulting stream because now some of the random bits get reused. In the worst case, if you were the only user of /dev/urandom and output the exact same sequence of bits from the mouse movements, an XOR would completely remove all randomness from the mouse movements (All 1's get flipped to 0's, all 0's stay the same). Even without the worst case though, it could still influence a pattern into the bits due to the reuse.