RC4 Class Reference

#include <rc4.h>

Inheritance diagram for RC4:

Inheritance graph
Collaboration diagram for RC4:

Collaboration graph

Detailed Description

Implementation of the RC4 stream cipher.

The ISC implementation of RC4 is compatible with RSADSI RC4, and with the cipher that the US State Dept. calls RC4; it is also known as "alleged RC4" and ARCFOUR.

Usage flow:
  RC4()    // instantiate a new RC4 object
  init()   // specify the key
  crypt()  // perform the encrypt or decrypt operation


Recommendations for strict FIPS 140-1 compliance:
  RC4 is not a FIPS approved algorithm, so the RC4 class should 
  *NOT* be used.

Sample code illustrating the use of this class appears in the Cookbook section Using the Symmetric Ciphers.

References

RC4 is specified and discussed in:


Public Member Functions

 RC4 ()
 Constructor. Calls init().
 ~RC4 ()
 Destructor. Calls init().
int init ()
 Initialize the RC4 object.
int init (int len, const char *key)
 Initialize the RC4 object and load a new key.
int add (int len, const char *b)
 Update the permutation controlling the internal pseudorandom number generator.
int crypt (int len, const char *src, char *dest)
 Encrypt or decrypt a specified buffer.
int gen ()
 Generate one pseudorandom byte.


Member Function Documentation

int add ( int  len,
const char *  b 
)

Update the permutation controlling the internal pseudorandom number generator.

Parameters:
len the length in bytes of the input buffer
b a pointer to the input buffer
Returns:
0 (success)
CDK_ERROR_STATE CDK_INVALID_PTR

int crypt ( int  len,
const char *  src,
char *  dest 
)

Encrypt or decrypt a specified buffer.

Parameters:
len the length of the input and output buffers in bytes
src a pointer to the input buffer
dest a pointer to the output buffer
Returns:
0 (success)
CDK_ERROR_STATE CDK_INVALID_PTR

int gen (  ) 

Generate one pseudorandom byte.

Returns:
a single byte from the internal pseudorandom number generator.

int init ( int  len,
const char *  key 
)

Initialize the RC4 object and load a new key.

Parameters:
len the length of key in bytes
key a pointer to the new key
Remarks:
All key material is reset, then add() is called to update the permutation controlling the internal pseudorandom number generator.
Returns:
0 (success)
CDK_ERROR_STATE
CDK_INVALID_PTR

int init (  ) 

Initialize the RC4 object.

Returns:
0 (success)
CDK_ERROR_STATE
Remarks:
This function resets the RC4 object to its initial state, zeroizing all key material.


The documentation for this class was generated from the following file:
ISC Cryptographic Development Kit - User's Guide
ISC website
Questions? E-mail ISC technical support
Copyright© 2002-2006 Information Security Corp. All rights reserved.