If I XOR the output from 2 CSPRNG will the result be better (more random) than the output from either one? Assume one of the PRNG is biased.
1 Answer
If you XOR two independent streams of two random number generators together then the result is as strong as the strongest of the two.
-
2$\begingroup$ More generally, if you XOR the streams of two independent random number generators together then the result is as strong as the strongest of the two. $\;$ $\endgroup$– user991Dec 5, 2013 at 8:20
-
$\begingroup$ How to determine if two PRNG are independent? I am thinking about using the default apple PRNG secCopyRandomBytes and the AutoSeeded RNG from the Botan library? How do I know that both of them don't do similar things inside? $\endgroup$ Dec 5, 2013 at 9:07
-
$\begingroup$ "Unrelated" is NOT the criterion. The criterion is that the keys be independently chosen, not that the algorithms be "unrelated" or "independent" (whatever that would mean). You can even use the same CSPRNG algorithm, as long as you have two independent keys. $\endgroup$– D.W.Dec 6, 2013 at 1:49
-
$\begingroup$ @D.W. What I meant was that the streams are unrelated, not the algorithms. Updated my answer. $\endgroup$– orlpDec 6, 2013 at 3:06
-
1$\begingroup$ If one is totally unbiased and the other is biased, doesn’t the bias “cut through” into the output stream of XOR, though? $\endgroup$ Dec 6, 2013 at 12:07