void RC4_set_key(key, len, data)
RC4_KEY *key;
int len;
unsigned char *data;
void RC4(key, len, in, out)
RC4_KEY *key;
unsigned long len;
unsigned char *in, *out;
typedef struct rc4_key_st { RC4_INT x,y; RC4_INT data[256]; } RC4_KEY;
where x and y are counters used during the encryption.
RC4 is a symmetric variable-length key stream cipher. A good key length is typically 16 bytes.
Only RC4-ECB has been implemented. This means that there is no initialization vector and there is no feedback of the cipher text into the cipher. This implies that you should not ever use the same key twice if you can help it. If you do, you leave yourself open to known plain text attacks; if you know the plain text and corresponding cipher text in one message, all messages that used the same key can have the cipher text decoded for the corresponding positions in the cipher stream.
The main positive feature of RC4 is that it is a very fast cipher, about 4 times faster that DES. This makes it ideally suited to protocols where the key is randomly chosen, like SSL.
RC4_set_key() converts the len-byte key in data into an RC4_KEY. Key length is typically 16 bytes.
RC4() encrypts/decrypts in into out using the key given by key. in and out may be of arbitrary length, as specified in len. Encryption and decrpytion are the same operation; no special flag to the function is needed.