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.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Let's pretend that all digits of pi are known and arbitrarily long sequences of digits are trivial to get. Further, some mathematician proves that there are no patterns in pi. We could create a stream cipher by grabbing a piece of pi as long as our plaintext and combining the two with some function (such as XOR or modulus addition.) The key would be the starting position in pi.

Would this be equivalent (in terms of security) to a one-time pad? To what sort of attacks would it be vulnerable?

share|improve this question
2  
Your assumption that there are no patterns in the digits of pi, surprisingly, turns out to be false. Amazing, but true! – D.W. Sep 22 '13 at 5:58
    
@D.W. link(s) please? All I'm finding is conspiracy theories(?), though I have found a claim that (if I understand correctly...) the distribution of digits is statistically random: thestarman.pcministry.com/math/pi/PiStats.htm – Code Jockey Sep 8 '15 at 15:35
1  
@CodeJockey, see mathoverflow.net/a/26970/37212 and rec-puzzles.org/index.php/Pi%20Solution. – D.W. Sep 8 '15 at 15:49
up vote 14 down vote accepted

The problem with this approach is that it literally gains you nothing. In order to choose a random subsequence of a needed length from $\pi$, you need to generate a cryptographically random number of at least the same length of the desired key to use as the offset. But then you may as well just use that number as your secret key.

Other than that, yes, it's exactly the same as a one-time pad. Just with a silly and pointless key derivation protocol which cannot mathematically increase the security of the system, but could conceivably weaken it.

Edit: As Thomas points out in the comments, the distribution of digits of $\pi$ are not random, and so this mechanism of key generation actually discards a significant amount of entropy that had been generated while choosing a random offset.

share|improve this answer
2  
The $n$th digit of $\pi$ is most certainly not a uniform random variable over $\mathbb{Z}_{10}$, therefore claiming that this scheme is equivalent to an OTP is incorrect (it may seem that choosing a random "starting position" is enough, but it's not - the underlying distribution of $\pi$ actually matters and if it is not uniformly random, it will destroy entropy encoded in said starting position). – Thomas Jan 26 '13 at 5:30
3  
One of the original stated assumptions was "there are no patterns in $\pi$", from which I (perhaps incorrectly) assumed he meant something along the lines of "the distribution of digits in $\pi$ is random". Certainly if the the digits of $\pi$ are not random (as you've correctly stated is the case), this mechanism is significantly weaker than a true OTP. – Stephen Touset Jan 26 '13 at 5:48
1  
Ah, I did not see Joshua's assumption - sorry! That'll teach me to comment without reading the entire thread.. – Thomas Jan 26 '13 at 5:52
1  
Nothing we've not all been guilty of at some point. Regardless, it was absolutely worth pointing out. – Stephen Touset Jan 26 '13 at 5:57
    
@Thomas: I know not result hinting at any bias in the digits of $π$ in any base; or at a distinguisher that would, in time independent of $n$, recognize with sizable advantage a fixed-length uniform random sequence from an equal length extract of the digits of $π$ starting at the $n$th. Is there such a thing? – fgrieu Jan 26 '13 at 14:08

I have a strong interest in one time pads, and I would suggest that your scheme is a poor substitute for two reasons:-

  1. What is the key to decode the message? It would have to be related (however indirectly) to the start position in the pi sequence. For example, you can decode my "Hello Joshua" message by starting XORing from 20,503rd digit of pi. So the key is 20503. A bit short eh? So the key becomes the pointer, and how long should that be therefore?

  2. Repudiation. If you destroy the OPT used to encrypt the message, no one will ever recover the plain text. Most of the the cold war OTP messages have never been decrypted for this reason. Your OPT will always exist and it's only a matter before someone stumbles upon the key /pointer.

share|improve this answer

Your algorithm is vulnerabel to brute force attacks. XOR the ciphertext with parts of the PI fraction starting with n and then with n+1 and so on. Today's fast computers won't take long to crack it. :)

share|improve this answer
1  
How would you brute force it if the key was e.g. 128 bits long? Brute force would take about as long as for a normal 128-bit cipher. – otus May 5 at 8:03

If it were possible to compute digits of pi from an arbitrary location (to generate the stream) in constant time, then it would be an excellent cipher. Unfortunately, this isn't possible.

Maurer suggested using the surface of the moon for a source of random information instead: link

share|improve this answer
1  
Actually you can calculate the (binary) digits of pi at an arbitrary position (without having to compute all the prior digits). Search wikipedia for the article on the Bailey–Borwein–Plouffe formula (link didn't work). – J.D. Sep 21 '13 at 18:10
4  
-1 Sorry, but this is utter bullshit. It is possible to compute digits of pi from an arbitrary location, and the resulting "cipher" is rubbish. – orlp Sep 22 '13 at 1:30
2  
@nightcracker - in fairness to Ummon Karpe, he did say compute arbitrary digits in constant time, which I missed the first time I read his answer. The fastest method I have heard of requires quadratic time. That said, the 'pi cipher' still doesn't sound like a good idea even if it were efficient. – J.D. Sep 22 '13 at 3:57

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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