I'm planning on combining RNGs from several sources (Windows, Linux, OpenBSD, etc.) for generating one time pads but I have some questions that I don't know how to answer regarding xoring the outputs of those random number generators together. Trying to search for answers to these is not doing well either.

Suppose we have 2 random number generators, g and h. If g is secure and h is not (an attacker can find some kind of pattern to predict future outputs or an attacker can influence or gather output data from said generator), is g ^ h secure? I believe this one is yes since if we have bits g1 and h1 and an attacker knows h1, g1 ^ h1 will be effectively random to said attacker since he does not know what g1 is.

Suppose we have an unbiased random number generator g and a biased (biased such that p(1) != p(0) and p(1) = C for some constant C) random number generator h. Is g ^ h unbiased? I sort of think this is yes but at the same time I'm not sure since then we should be able to just xor any biased (constant) random number generator output with 0xAA and get an unbiased one.

To go along with the previous question suppose we have a biased (constant like h in the previous question) random number generator and we xor every other output bit with 1. Is the output unbiased?

  1. Yes combining anything with the output of a good RNG will result in good random numbers (as long as they don't have information from your RNG)

  2. Yes it would remove the bias (but there are other ways to do this whitening also)

  3. No that doesn't really do anything interesting, but a simple way to unbias your numbers is a Von Neumann extractor

Also try to find non deterministic sources, be suspicious of random data from strangers.

  • $\begingroup$ Any reason why flipping every other bit in a biased generator wouldn't remove the bias if the bias is strictly a preference for an on or off bit? I guess an attacker would be able to flip them back to get back to get the biased output again. $\endgroup$ – user Oct 5 '17 at 14:57
  • $\begingroup$ Yup, also it's not a way of whitening since if you fed it a signal like "0000..." you would just get "0101..." which isn't what you want $\endgroup$ – daniel Oct 5 '17 at 15:12

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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