1*2175Sjp161948=pod 2*2175Sjp161948 3*2175Sjp161948=head1 NAME 4*2175Sjp161948 5*2175Sjp161948RC4_set_key, RC4 - RC4 encryption 6*2175Sjp161948 7*2175Sjp161948=head1 SYNOPSIS 8*2175Sjp161948 9*2175Sjp161948 #include <openssl/rc4.h> 10*2175Sjp161948 11*2175Sjp161948 void RC4_set_key(RC4_KEY *key, int len, const unsigned char *data); 12*2175Sjp161948 13*2175Sjp161948 void RC4(RC4_KEY *key, unsigned long len, const unsigned char *indata, 14*2175Sjp161948 unsigned char *outdata); 15*2175Sjp161948 16*2175Sjp161948=head1 DESCRIPTION 17*2175Sjp161948 18*2175Sjp161948This library implements the Alleged RC4 cipher, which is described for 19*2175Sjp161948example in I<Applied Cryptography>. It is believed to be compatible 20*2175Sjp161948with RC4[TM], a proprietary cipher of RSA Security Inc. 21*2175Sjp161948 22*2175Sjp161948RC4 is a stream cipher with variable key length. Typically, 128 bit 23*2175Sjp161948(16 byte) keys are used for strong encryption, but shorter insecure 24*2175Sjp161948key sizes have been widely used due to export restrictions. 25*2175Sjp161948 26*2175Sjp161948RC4 consists of a key setup phase and the actual encryption or 27*2175Sjp161948decryption phase. 28*2175Sjp161948 29*2175Sjp161948RC4_set_key() sets up the B<RC4_KEY> B<key> using the B<len> bytes long 30*2175Sjp161948key at B<data>. 31*2175Sjp161948 32*2175Sjp161948RC4() encrypts or decrypts the B<len> bytes of data at B<indata> using 33*2175Sjp161948B<key> and places the result at B<outdata>. Repeated RC4() calls with 34*2175Sjp161948the same B<key> yield a continuous key stream. 35*2175Sjp161948 36*2175Sjp161948Since RC4 is a stream cipher (the input is XORed with a pseudo-random 37*2175Sjp161948key stream to produce the output), decryption uses the same function 38*2175Sjp161948calls as encryption. 39*2175Sjp161948 40*2175Sjp161948Applications should use the higher level functions 41*2175Sjp161948L<EVP_EncryptInit(3)|EVP_EncryptInit(3)> 42*2175Sjp161948etc. instead of calling the RC4 functions directly. 43*2175Sjp161948 44*2175Sjp161948=head1 RETURN VALUES 45*2175Sjp161948 46*2175Sjp161948RC4_set_key() and RC4() do not return values. 47*2175Sjp161948 48*2175Sjp161948=head1 NOTE 49*2175Sjp161948 50*2175Sjp161948Certain conditions have to be observed to securely use stream ciphers. 51*2175Sjp161948It is not permissible to perform multiple encryptions using the same 52*2175Sjp161948key stream. 53*2175Sjp161948 54*2175Sjp161948=head1 SEE ALSO 55*2175Sjp161948 56*2175Sjp161948L<blowfish(3)|blowfish(3)>, L<des(3)|des(3)>, L<rc2(3)|rc2(3)> 57*2175Sjp161948 58*2175Sjp161948=head1 HISTORY 59*2175Sjp161948 60*2175Sjp161948RC4_set_key() and RC4() are available in all versions of SSLeay and OpenSSL. 61*2175Sjp161948 62*2175Sjp161948=cut 63