Take the 2-minute tour ×
Cryptography Stack Exchange is a question and answer site for software developers, mathematicians and others interested in cryptography. It's 100% free, no registration required.

This question already has an answer here:

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.

share|improve this question

marked as duplicate by D.W., rath, AFS, figlesquidge, Gilles Dec 6 '13 at 13:09

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

How are they keyed? With two independent keys? Also, if one is a CSPRNG, then it cannot be biased (to be cryptographically secure means that it can't be biased). –  D.W. Dec 6 '13 at 1:47

1 Answer 1

If you XOR two independent streams of two random number generators together then the result is as strong as the strongest of the two.

share|improve this answer
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. $\;$ –  Ricky Demer Dec 5 '13 at 8:20
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? –  user1028028 Dec 5 '13 at 9:07
"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. –  D.W. Dec 6 '13 at 1:49
@D.W. What I meant was that the streams are unrelated, not the algorithms. Updated my answer. –  nightcracker Dec 6 '13 at 3:06
If one is totally unbiased and the other is biased, doesn’t the bias “cut through” into the output stream of XOR, though? –  mirabilos Dec 6 '13 at 12:07

Not the answer you're looking for? Browse other questions tagged or ask your own question.