Cryptography Stack Exchange is a question and answer site for software developers, mathematicians and others interested in cryptography. Join them; it only takes a minute:

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

Hi I have a stream cipher which uses a keystream of:

F(r) || F(r+1) || F(r+2) || ...

Suppose F(r) is the RSA encryption algorithm:

F(r) = r^e mod p where e and p are known , e = 3

My question is: If we know F(r), F(r+1) and F(r+2), how can we calculate the subsequent key sequence?

Is there some obvious relation between F(r+3) and F(r),F(r+1),F(r+2) I don't see?

share|improve this question
Forget RSA. For any unknown x, can you calculate $(x+c)^3$ for any integer $c$? – pg1989 Dec 1 '13 at 9:39
x^3 + c^3 + 3*x^2*c + 3*x*c^2 ? is that what you're asking? – Ajit Dec 1 '13 at 9:48
Hint: you can. Can you add or subtract terms of the subsequent expressions to get terms of the key sequence? – pg1989 Dec 1 '13 at 9:51
up vote 3 down vote accepted

I'll expand my comments into a full answer.

Start by examining that you know the value of $r^3$ - this is just $F(r)$.

You know you can express $F(r+1)$ and $F(r+2)$ symbolically. You can do this for any term in the key sequence, but it will be useful to write down $F(r+3)$. Forget any constant terms in the computations because they can be added in at the end.

Do you notice anything about the coefficients of $r^2$ and $r$ in the expressions for $F(r+1)$ and $F(r+2)$? Do they look like the coefficients of any subsequent terms in the key sequence?

share|improve this answer
Got it! I was thinking along the wrong lines. Thanks a lot ! – Ajit Dec 1 '13 at 10:09
No problem. Good luck with your assignment. – pg1989 Dec 1 '13 at 10:21

Your Answer


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.