Take the 2-minute tour ×  I would like to ask you about your
opinion on the following scheme of combining a master key and a
nonce and stretching the result to the full 256-bytes RC4 key.
• Master key $K_m$ is a pre-shared secret of length $M$ bytes
• nonce $K_n$ is sent unencrypted and is of length $N$ bytes   •
both $K_m$ and $K_n$ are chosen to be high-entropy strings   •
the $i$-th byte of the resulting key would be $K[i] = (K_m[i
\bmod M] + K_n[i \bmod N]) \bmod 256$  The period of the string
$K$ is $LCM(M,N)$, so I would choose the $M$ and $N$ such that
$LCM(M,N) \ge 256$.  Is there anything obviously wrong with this
scheme?  PS: This scheme would be used on an 8-bit micro-
controller embedded system. Limited speed/memory prevents me
from using a more standard method.  share|improve this question
OK, so in the end I will use RC4-drop512, with my scheme of
combining the master key and the nonce. The nonce will be sent
in two steps: first unencrypted with the corresponding generated
PRN stream used on