ccs.chaos
Class ChaosModel

java.lang.Object
  extended by ccs.chaos.ChaosModel
All Implemented Interfaces:
java.io.Serializable

public class ChaosModel
extends java.lang.Object
implements java.io.Serializable

The state of the ChaosMage. The ChaosMage only exposes a (bowdlerised) copy of this over its API and never accepts one back, so it's OK that the members aren't protected with getter/setter pairs.

See Also:
Serialized Form

Field Summary
 byte[] cipherKey
          Cipher key.
 long counter
          Counter.
 double fastEntropy
          Total estimated entropy in fast pool.
 byte[] fastPool
          Hash state - effectively the entropy pool.
 int gateLeft
          Blocks left before next generator gate.
static int GATELENGTH
          The number of blocks between generator gates.
protected  int marshalVersion
           
static int NEEDENTROPY
          State value: reseed needed, but no entropy to do it.
static int NEEDRESEED
          State value: reseed needed, and at least minimal entropy is available.
static int RUN
          State value: generator OK, random blocks available.
 long runLeft
          Blocks left before next reseed.
static long RUNLENGTH
          The maximum run length, in 64-bit blocks between reseeds.
 int status
          The current generator state.
 
Constructor Summary
ChaosModel()
           
ChaosModel(ChaosModel cm)
          Construct a bowdlerised copy of a ChaosModel.
 
Method Summary
 void marshal(java.io.DataOutputStream dest)
           
 void transientMarshal(java.io.DataOutputStream dos)
           
 void transientUnmarshal(java.io.DataInputStream src)
           
 void unmarshal(java.io.DataInputStream src)
           
 void xmlMarshal(CXTStream cxt)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RUNLENGTH

public static final long RUNLENGTH
The maximum run length, in 64-bit blocks between reseeds. There is an argument for this which I can't be bothered to repeat here (i.e. it's not just pulled from thin air).

See Also:
Constant Field Values

GATELENGTH

public static final int GATELENGTH
The number of blocks between generator gates. The value is from the paper, see there for details.

See Also:
Constant Field Values

NEEDENTROPY

public static final int NEEDENTROPY
State value: reseed needed, but no entropy to do it.

See Also:
Constant Field Values

NEEDRESEED

public static final int NEEDRESEED
State value: reseed needed, and at least minimal entropy is available. The user has the option to put extra entropy into the pool, for good luck.

See Also:
Constant Field Values

RUN

public static final int RUN
State value: generator OK, random blocks available.

See Also:
Constant Field Values

runLeft

public long runLeft
Blocks left before next reseed.


gateLeft

public int gateLeft
Blocks left before next generator gate. Generator gates occur after every tenth block.


fastEntropy

public double fastEntropy
Total estimated entropy in fast pool.


status

public int status
The current generator state.


fastPool

public byte[] fastPool
Hash state - effectively the entropy pool. There's supposed to be a slow pool as well, but until we implement some kind of automatic entropy-gathering system there's not much point. Secret.


cipherKey

public byte[] cipherKey
Cipher key. Secret.


counter

public long counter
Counter. Encrypted to obtain next block. Secret.


marshalVersion

protected int marshalVersion
Constructor Detail

ChaosModel

public ChaosModel()

ChaosModel

public ChaosModel(ChaosModel cm)
Construct a bowdlerised copy of a ChaosModel. This contains all the status information but not the secrets (the pools, cipher key and counter).

Method Detail

xmlMarshal

public void xmlMarshal(CXTStream cxt)
                throws java.io.IOException
Throws:
java.io.IOException

transientMarshal

public void transientMarshal(java.io.DataOutputStream dos)
                      throws java.io.IOException
Throws:
java.io.IOException

marshal

public void marshal(java.io.DataOutputStream dest)
             throws java.io.IOException
Throws:
java.io.IOException

transientUnmarshal

public void transientUnmarshal(java.io.DataInputStream src)
                        throws java.io.IOException
Throws:
java.io.IOException

unmarshal

public void unmarshal(java.io.DataInputStream src)
               throws java.io.IOException
Throws:
java.io.IOException