All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class is.logi.crypto.random.RandomSpinner

java.lang.Object
   |
   +----java.util.Random
           |
           +----is.logi.crypto.random.RandomSpinner

public class RandomSpinner
extends Random
This class uses the scheduler to generate random numbers. It counts the number of times a loop is repeated before a thread has slept for a specified number of milliseconds. These numbers are then fed to a hash function to mask any possible correlations.

Before any random bytes are returned the internal entropy pool is filled with the specified number of bytes from the scheduler. This initialization is performed in a separate thread and may take a few seconds. You should therefore create instances of the RandomSpinner well before using them.

The helper class which is used to gather entropy was written by Henry Strickland (strix@versant.com) and Greg Noel (greg@qualcomm.com). It is based on similar C code by Matt Blaze, Jack Lacy, and Don Mitchell.

This generator is normally somewhat slower than the SecureRandom generator in the java library, since it spends some time collecting entropy.

Author:
Logi Ragnarsson (logir@hi.is)

Constructor Index

 o RandomSpinner()
 o RandomSpinner(int, int)
Creates a new instance of the RandomSpinner class.

Constructors

 o RandomSpinner
 public RandomSpinner(int initial,
                      int round)
Creates a new instance of the RandomSpinner class. It will be initialized with initial bytes from the Spinner and collect round bytes from it for every 16 bytes it outputs.

Parameters:
round - must be in the range 0..64
 o RandomSpinner
 public RandomSpinner()

All Packages  Class Hierarchy  This Package  Previous  Next  Index