aboutsummaryrefslogtreecommitdiff
path: root/man/man3/rc4.3
blob: 026c8352f594d4585c9c87ce66466df23a1c938c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
.TH RC4 3
.SH NAME
setupRC4state, rc4, rc4skip, rc4back  - alleged rc4 encryption
.SH SYNOPSIS
.B #include <u.h>
.br
.B #include <libc.h>
.br
.B #include <mp.h>
.br
.B #include <libsec.h>
.PP
.B
void	setupRC4state(RC4state *s, uchar *seed, int slen)
.PP
.B
void	rc4(RC4state *s, uchar *data, int dlen)
.PP
.B
void	rc4skip(RC4state *s, int nbytes)
.PP
.B
void	rc4back(RC4state *s, int nbytes)
.SH DESCRIPTION
.PP
This is an algorithm alleged to be Rivest's RC4 encryption function.  It is
a pseudo-random number generator with a 256 byte state and a long
cycle.  The input buffer is XOR'd with the output of the
generator both to encrypt and to decrypt.  The seed, entered
using
.IR setupRC4state ,
can be any length.  The generator can be run forward using
.IR rc4 ,
skip over bytes using
.I rc4skip 
to account lost transmissions,
or run backwards using
.I rc4back
to cover retransmitted data.
The
.I RC4state
structure keeps track of the algorithm.
.SH SOURCE
.B \*9/src/libsec
.SH SEE ALSO
.IR mp (3),
.IR aes (3),
.IR blowfish (3),
.IR des (3),
.IR dsa (3),
.IR elgamal (3),
.IR rsa (3),
.IR sechash (3),
.IR prime (3),
.IR rand (3)