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

Quick Search    Search Deep

mindbright.security
Class SecureRandom  view SecureRandom download SecureRandom.java

java.lang.Object
  extended byjava.util.Random
      extended bymindbright.security.SecureRandom
All Implemented Interfaces:
java.io.Serializable

public class SecureRandom
extends java.util.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.


Field Summary
(package private)  MD5 md5
           
(package private)  int poolSweep
           
static int secureLevel
           
private  int t
           
(package private)  byte[] unused
          unused[unusedPos..15] is unused pseudo-random numbers.
(package private)  java.lang.Object unusedLock
           
(package private)  int unusedPos
           
 java.lang.Thread updater
           
 
Fields inherited from class java.util.Random
 
Constructor Summary
SecureRandom()
           
SecureRandom(byte[] seed)
           
 
Method Summary
protected  int next(int bits)
          Generates the next random number.
 void nextPadBytes(byte[] bytes, int len)
           
 void nextPadBytes(byte[] bytes, int off, int len)
           
 void startUpdater()
           
protected  void update()
          Get new unused bytes.
static void writeBytes(long a, byte[] dest, int i, int length)
           
 
Methods inherited from class java.util.Random
nextBoolean, nextBytes, nextDouble, nextFloat, nextGaussian, nextInt, nextInt, nextLong, setSeed
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

md5

MD5 md5

t

private int t

updater

public java.lang.Thread updater

secureLevel

public static int secureLevel

unused

byte[] unused
unused[unusedPos..15] is unused pseudo-random numbers.


unusedPos

int unusedPos

unusedLock

java.lang.Object unusedLock

poolSweep

int poolSweep
Constructor Detail

SecureRandom

public SecureRandom()

SecureRandom

public SecureRandom(byte[] seed)
Method Detail

update

protected void update()
Get new unused bytes.


next

protected int next(int bits)
Generates the next random number.


startUpdater

public void startUpdater()

nextPadBytes

public void nextPadBytes(byte[] bytes,
                         int len)

nextPadBytes

public void nextPadBytes(byte[] bytes,
                         int off,
                         int len)

writeBytes

public static final void writeBytes(long a,
                                    byte[] dest,
                                    int i,
                                    int length)