All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class evote.util.genrand.GenRand

java.lang.Object
   |
   +----evote.util.genrand.GenRand

public class GenRand
extends Object
The GenRand class generates cryptographically secure random numbers by opening a dialog box that tracks the user's cursor movements and hashing that to create a seed for the SecureRandom() method in Sun's JDK. It may be instantiated by inserting a line like the following in your source code: "GenRand gr = new GenRand()".


Constructor Index

 o GenRand()

Method Index

 o nextBytes(int)
Using the SecureRandom() pseudo random number generator supplied by Sun, the specified number of random bytes are returned.
 o seed()
Call the seed() method to open a dialog that tracks the user's cursor movements until a certain number of bytes of data is generated.

Constructors

 o GenRand
  public GenRand()

Methods

 o seed
  public void seed()
Call the seed() method to open a dialog that tracks the user's cursor movements until a certain number of bytes of data is generated. Those bytes are then hashed using SHA (as provided in Sun's JDK). Finally, that 160-bit hash is used to seed Sun's SecureRandom() pseudo random number generator (PRNG).

 o nextBytes
  public synchronized byte[] nextBytes(int numBytes)
Using the SecureRandom() pseudo random number generator supplied by Sun, the specified number of random bytes are returned. The seed() method must be called before the nextBytes() function is called.


All Packages  Class Hierarchy  This Package  Previous  Next  Index