If two strings of equal length from random offsets in Pi were XORed together, would this result in a cryptographically secure random number suitable for use in a one-time pad? If so, would this mean that using a secure low-bandwidth channel, you could bass three digits (two offsets and a length) to provide an arbitrarily long pad?

  • 2
    $\begingroup$ OTP is information-theoretically secure even for unbounded adversaries. $\pi$ is not a good random number generator. Therefore no! $\endgroup$
    – kelalaka
    Dec 24, 2019 at 17:32
  • $\begingroup$ If a single Pi based stream cipher (not an OTP) is not secure and biased, then XOR'ing two of them together won't make much of a difference. Have you read this Q/A. If so, does it answer your question. If not, what questions are still left for you? $\endgroup$
    – Maarten Bodewes
    Dec 28, 2019 at 20:48
  • $\begingroup$ Thank you for the pointer. This, and the comments here, have answered my questions. $\endgroup$
    – user4372
    Dec 29, 2019 at 21:10

1 Answer 1


There's no benefit whatsoever to using XOR here. Pi is already believed to be Normal which means the stream of digits is indistinguishable from random in every base.

The offset into Pi functions as a key, for your system to be secure this key must be very large (e.g. several dozen decimal digits long) and chosen entirely at random, and it must not become known to anybody except the communication parties. With those constraints you should just use a stream cipher which is intended for this purpose.

If you just believe that "Nobody" would guess that your "three digits" are the key to a cipher based on Pi and so it's safe to just transmit the key to the other party you're relying on Security by Obscurity and might just as well use mirror writing or pig latin or something.

  • 3
    $\begingroup$ Bailey-Borwein-Plouffe formula which indicates a certain predictability in the base-16 digits of π. $\endgroup$
    – kelalaka
    Dec 24, 2019 at 20:43
  • $\begingroup$ Interesting. I don't think XOR is going to help you with that. $\endgroup$
    – Maarten Bodewes
    Dec 28, 2019 at 20:32
  • $\begingroup$ Going from "normal" to "random" is a leap that deserves to have a source cited. Being normal just means that "digits" in some base have an approximately equal number of occurrences over the infinite non-repeating sequence of its digits. That doesn't mean you wouldn't find local biases more often than expected. (Even for numbers which are normal bases, possibly.) In a very casual web search I couldn't find a counterexample to normality in all bases implying that the digits look random. Nor did I find anything proving the same idea. $\endgroup$ Dec 28, 2019 at 22:41
  • $\begingroup$ When no base is specified, "Normal" means "Normal in all bases". Although we can prove that Almost All numbers are Normal, we have no known examples (the best we can do is that some of the Non-computable numbers are definitely normal, but, they're non-computable so that's not very helpful). However it is thought likely that Pi and several other transcendental constants are Normal (which again, means in all bases). $\endgroup$
    – tialaramex
    Dec 29, 2019 at 11:39
  • $\begingroup$ Thank you to all for your comments here. It has clarified my understanding of the nature of randomness in Pi. My interest was, if Pi was truly random and suitable for cryptographic use, XORing to different sections would provide a number that could not be found by exhaustive search. Contrary to some thinking here, I was not looking for key index numbers to be transmitted in the clear. I was not counting on security by obscurity. Thank you again for your help. $\endgroup$
    – user4372
    Dec 29, 2019 at 21:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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