RC4(Rivest Cipher 4), also called ARC4, is a stream cipher. It is used widely because of its simplicity and remarkable speed. The length of initial key is not greater 256, 1<=key-length<=256. The encryption and decryption use a same RC4 algorithm as long as input same initial key.
RC4 consist of 2 parts: initialization state, generate key stream and its encryption. Initial state is derived from input key while the key stream is generated by Pseudo-Random Generation Algorithm (PRGA) based on inner state. Inner states is stored in a array with 256 bytes. In each iteration, a byte key is output by PRGA and used to operate bitwise exclusive(XOR) with a byte in plain text. Its input width is 8 bits, so does output width.
Performance (Device: U250)¶