Consider the following modification of RC4 to give some "ciphertext feedback"
i ← 0
j ← 0
C ← 0 -- We will remember the previous output ciphertext byte.
repeat
i ← (i + 1) mod 256
j ← (j + S[i] + C) mod 256 -- Use the previous ciphertext byte
-- for "ciphertext feedback".
S[i] ↔ S[j]
input P -- Read the next byte of plaintext
C ← S[(S[i] + S[j]) mod 256] xor P
output C -- Output the next byte of ciphertext
It would be nice to be able to use RC4 in some sort of plaintext-dependent mode like this, to avoid various stream cipher weaknesses while still having a cheap cipher that is easy to implement.
Is there something obvious (or non-obvious) that goes wrong here? [Edit: Other than my ability to write appropriate pseudocode on the first try.]