Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

gnu.javax.crypto.prng
Class ARCFour  view ARCFour download ARCFour.java

java.lang.Object
  extended bygnu.java.security.prng.BasePRNG
      extended bygnu.javax.crypto.prng.ARCFour
All Implemented Interfaces:
java.lang.Cloneable, gnu.java.security.prng.IRandom

public class ARCFour
extends gnu.java.security.prng.BasePRNG
implements java.lang.Cloneable

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.
private  byte m
           
private  byte n
           
private  byte[] s
          The S-box.
 
Fields inherited from class gnu.java.security.prng.BasePRNG
buffer, initialised, name, ndx
 
Constructor Summary
ARCFour()
          Default 0-arguments constructor.
 
Method Summary
 void fillBlock()
           
 void setup(java.util.Map attributes)
           
 
Methods inherited from class gnu.java.security.prng.BasePRNG
addRandomByte, addRandomBytes, addRandomBytes, clone, init, isInitialised, name, nextByte, nextBytes, 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

s

private byte[] s
The S-box.


m

private byte m

n

private byte n
Constructor Detail

ARCFour

public ARCFour()
Default 0-arguments constructor.

Method Detail

setup

public void setup(java.util.Map attributes)

fillBlock

public void fillBlock()
               throws gnu.java.security.prng.LimitReachedException