I am confused about stream ciphers a little so I just wanted to clarify. We have a key that's lets say 2 bits. I have a message that's 8 bits. I used a pseudorandom generator that would add 6 bits to my key. Those 6 bits are deterministic and public. Hence why it's called pseudorandom, it looks random but because the 6 bits are deterministic, it's not. So that makes my keystream, regardless of the key, those 6 bits will be added. Now I simply XOR with my original message?
That is one instantiation of an additive stream cipher over the binary alphabet under the assumptions:
- The $k$ bit key is random and uniformly distributed
- The pseudorandom generator takes the key as input and generates $n$ keystream bits. Sometimes it is iterated not $n-k$ times but more to remove the initial condition (i.e., the key) from the pseudorandom generator's state and to obtain enough mixing of the entropy from the key
- the keystream bits are added modulo 2 to the original message stream and the resulting encrypted stream is transmitted.
Of course keylengths of $80-128$ bits (at least) are needed for security.
Nowadays, IV's and nonces are used in more complex ways for more security in modern stream ciphers.
See the following questions for more details on stream ciphers and their links to other primitives: