xref: /freebsd/crypto/openssl/doc/man3/RC4_set_key.pod (revision cfd6422a5217410fbd66f7a7a8a64d9d85e61229)
1=pod
2
3=head1 NAME
4
5RC4_set_key, RC4 - RC4 encryption
6
7=head1 SYNOPSIS
8
9 #include <openssl/rc4.h>
10
11 void RC4_set_key(RC4_KEY *key, int len, const unsigned char *data);
12
13 void RC4(RC4_KEY *key, unsigned long len, const unsigned char *indata,
14          unsigned char *outdata);
15
16=head1 DESCRIPTION
17
18This library implements the Alleged RC4 cipher, which is described for
19example in I<Applied Cryptography>.  It is believed to be compatible
20with RC4[TM], a proprietary cipher of RSA Security Inc.
21
22RC4 is a stream cipher with variable key length.  Typically, 128 bit
23(16 byte) keys are used for strong encryption, but shorter insecure
24key sizes have been widely used due to export restrictions.
25
26RC4 consists of a key setup phase and the actual encryption or
27decryption phase.
28
29RC4_set_key() sets up the B<RC4_KEY> B<key> using the B<len> bytes long
30key at B<data>.
31
32RC4() encrypts or decrypts the B<len> bytes of data at B<indata> using
33B<key> and places the result at B<outdata>.  Repeated RC4() calls with
34the same B<key> yield a continuous key stream.
35
36Since RC4 is a stream cipher (the input is XORed with a pseudo-random
37key stream to produce the output), decryption uses the same function
38calls as encryption.
39
40=head1 RETURN VALUES
41
42RC4_set_key() and RC4() do not return values.
43
44=head1 NOTE
45
46Applications should use the higher level functions
47L<EVP_EncryptInit(3)> etc. instead of calling these
48functions directly.
49
50It is difficult to securely use stream ciphers. For example, do not perform
51multiple encryptions using the same key stream.
52
53=head1 SEE ALSO
54
55L<EVP_EncryptInit(3)>
56
57=head1 COPYRIGHT
58
59Copyright 2000-2016 The OpenSSL Project Authors. All Rights Reserved.
60
61Licensed under the OpenSSL license (the "License").  You may not use
62this file except in compliance with the License.  You can obtain a copy
63in the file LICENSE in the source distribution or at
64L<https://www.openssl.org/source/license.html>.
65
66=cut
67