For the latest news and information visit The GNU Crypto project

## gnu.crypto.prng
Class ARCFour

    java.lang.Object
      |
      +--gnu.crypto.prng.BasePRNG
            |
            +--gnu.crypto.prng.ARCFour

All Implemented Interfaces:
  java.lang.Cloneable, IRandom

public class ARCFour
extends BasePRNG

RC4 is a stream cipher developed by Ron Rivest. Until 1994 RC4 was a trade secret of RSA Data Security, Inc., when it was released anonymously to a mailing list. This version is a descendent of that code, and since there is no proof that the leaked version was in fact RC4 and because "RC4" is a trademark, it is called "ARCFOUR", short for "Allegedly RC4".

This class only implements the keystream of ARCFOUR. To use this as a stream cipher, one would say:

        out = in ^ arcfour.nextByte();

This operation works for encryption and decryption.

References:

1. Schneier, Bruce: Applied Cryptography: Protocols, Algorithms, and Source Code in C, Second Edition. (1996 John Wiley and Sons), pp. 397--398. ISBN 0-471-11709-9
2. K. Kaukonen and R. Thayer, "A Stream Cipher Encryption Algorithm 'Arcfour'", Internet Draft (expired), draft-kaukonen-cipher-arcfour-03.txt

Field Summary
`static java.lang.String` `ARCFOUR_KEY_MATERIAL` The attributes property name for the key bytes.
`static int` `ARCFOUR_SBOX_SIZE` The size of the internal S-box.

Fields inherited from class gnu.crypto.prng.BasePRNG
`buffer, initialised, name, ndx`

Constructor Summary
`ARCFour()` Default 0-arguments constructor.

Method Summary
`java.lang.Object` `clone()` Returns a clone copy of this instance.
`void` `fillBlock()`
`void` `setup(java.util.Map attributes)`

Methods inherited from class gnu.crypto.prng.BasePRNG
`init, isInitialised, name, nextByte, nextBytes`

Methods inherited from class java.lang.Object
`equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### ARCFOUR_KEY_MATERIAL

    public static final java.lang.String ARCFOUR_KEY_MATERIAL

  The attributes property name for the key bytes.

  See Also:
    Constant Field Values

### ARCFOUR_SBOX_SIZE

    public static final int ARCFOUR_SBOX_SIZE

  The size of the internal S-box.

  See Also:
    Constant Field Values

Constructor Detail

### ARCFour

    public ARCFour()

  Default 0-arguments constructor.

Method Detail

### clone

    public java.lang.Object clone()

  Description copied from interface: `IRandom`

  Returns a clone copy of this instance.

  Specified by:
    `clone` in interface `IRandom`
  Specified by:
    `clone` in class `BasePRNG`
  Returns:
    a clone copy of this instance.

### setup

    public void setup(java.util.Map attributes)

  Specified by:
    `setup` in class `BasePRNG`

### fillBlock

    public void fillBlock()
                   throws LimitReachedException

  Specified by:
    `fillBlock` in class `BasePRNG`
    `LimitReachedException`

For the latest news and information visit The GNU Crypto project

Copyright © 2001, 2002, 2003, 2004 Free Software Foundation, Inc.