gnu.crypto.prng

Class BasePRNG

public abstract class BasePRNG extends Object implements IRandom

An abstract class to facilitate implementing PRNG algorithms.

Version: $Revision: 1.12 $

Field Summary
protected byte[]buffer
A temporary buffer to serve random bytes.
protected booleaninitialised
Indicate if this instance has already been initialised or not.
protected Stringname
The canonical name prefix of the PRNG algorithm.
protected intndx
The index into buffer of where the next byte will come from.
Constructor Summary
protected BasePRNG(String name)

Trivial constructor for use by concrete subclasses.

Method Summary
voidaddRandomByte(byte b)
voidaddRandomBytes(byte[] buffer)
voidaddRandomBytes(byte[] buffer, int offset, int length)
Objectclone()
abstract voidfillBlock()
voidinit(Map attributes)
booleanisInitialised()
Stringname()
bytenextByte()
voidnextBytes(byte[] out)
voidnextBytes(byte[] out, int offset, int length)
abstract voidsetup(Map attributes)

Field Detail

buffer

protected byte[] buffer
A temporary buffer to serve random bytes.

initialised

protected boolean initialised
Indicate if this instance has already been initialised or not.

name

protected String name
The canonical name prefix of the PRNG algorithm.

ndx

protected int ndx
The index into buffer of where the next byte will come from.

Constructor Detail

BasePRNG

protected BasePRNG(String name)

Trivial constructor for use by concrete subclasses.

Parameters: name the canonical name of this instance.

Method Detail

addRandomByte

public void addRandomByte(byte b)

addRandomBytes

public void addRandomBytes(byte[] buffer)

addRandomBytes

public void addRandomBytes(byte[] buffer, int offset, int length)

clone

public Object clone()

fillBlock

public abstract void fillBlock()

init

public void init(Map attributes)

isInitialised

public boolean isInitialised()

name

public String name()

nextByte

public byte nextByte()

nextBytes

public void nextBytes(byte[] out)

nextBytes

public void nextBytes(byte[] out, int offset, int length)

setup

public abstract void setup(Map attributes)
Copyright © 2001, 2002, 2003 Free Software Foundation, Inc. All Rights Reserved.