plan9port

fork of plan9port with libvec, libstr and libsdb
Log | Files | Refs | README | LICENSE

rc4.3 (1146B)


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