Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.mindbright.security.prng
Class BlumBlumShub

    java.lang.Object
      com.mindbright.jca.security.SecureRandomSpi
          com.mindbright.security.prng.BlumBlumShub

All Implemented Interfaces:
  java.io.Serializable

public final class BlumBlumShub
extends SecureRandomSpi

An implementation of the Blum Blum Shub pseudo random number generator. This PRNGD is slow but is believed to be very strong.

See Also:
  Serialized Form

Field Summary
`static byte[]` | `N` Precalculated big modulus (using the getBlumInteger method with bits = 1024 and using built in SecureRandom in jdk 1.1.8 from IBM)

Constructor Summary
`BlumBlumShub()` Creates an unseeded instance which uses the built in modulus N
`BlumBlumShub(java.math.BigInteger n, byte[] seed)` Creates an instance with a custom modulus (M), do NOT use this unless you know exactly what you are doing.
`BlumBlumShub(byte[] seed)` Creates an instance which uses the built in modulus N

Method Summary
`protected byte[]` | `engineGenerateSeed(int numBytes)` Generate a number of random seed bytes.
`protected void` | `engineNextBytes(byte[] bytes)` Generate random bytes
`protected void` | `engineSetSeed(byte[] seed)` Set the seed used by the random number generator.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### N

    public static final byte[] N

  Precalculated big modulus (using the getBlumInteger method with bits = 1024 and using built in SecureRandom in jdk 1.1.8 from IBM)

Constructor Detail

### BlumBlumShub

    public BlumBlumShub(java.math.BigInteger n,
                        byte[] seed)

  Creates an instance with a custom modulus (M), do NOT use this unless you know exactly what you are doing. The value of the modulus is very important for the security of the algorithm and there are some specific requirements on how to generate it. Do not use this constructor unless you know exactly what you are doing.

Parameters:
  `n` - modulus M to use in algorithm.
  `seed` - random bytes used to seed the generator

### BlumBlumShub

    public BlumBlumShub(byte[] seed)

  Creates an instance which uses the built in modulus N

Parameters:
  `seed` - random bytes used to seed the generator

### BlumBlumShub

    public BlumBlumShub()

  Creates an unseeded instance which uses the built in modulus N

Method Detail

### engineGenerateSeed

    protected byte[] engineGenerateSeed(int numBytes)

  Description copied from class: `SecureRandomSpi`
  Generate a number of random seed bytes.

  Specified by:
    `engineGenerateSeed` in class `SecureRandomSpi`
  Parameters:
    `numBytes` - how many bytes to generate
  Returns:
    an array filled with the requested number of random bytes

### engineNextBytes

    protected void engineNextBytes(byte[] bytes)

  Description copied from class: `SecureRandomSpi`
  Generate random bytes

  Specified by:
    `engineNextBytes` in class `SecureRandomSpi`
  Parameters:
    `bytes` - array which should be filled with random bytes

### engineSetSeed

    protected void engineSetSeed(byte[] seed)

  Description copied from class: `SecureRandomSpi`
  Set the seed used by the random number generator.

  Specified by:
    `engineSetSeed` in class `SecureRandomSpi`
  Parameters:
    `seed` - an array of random bytes

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD