# Weak Stream Cipher cryptanalysis

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?

-
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

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?