Top Description Inners Constructors Methods
org.bouncycastle.crypto.prng

public Class ThreadedSeedGenerator

extends Object
Class Inheritance

A thread based seed generator - one source of randomness.

Based on an idea from Marcus Lippert.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public byte[]
generateSeed(int
the number of bytes to generate
numBytes
,
boolean
true if fast mode should be used
fast
)

Generate seed bytes.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

ThreadedSeedGeneratorback to summary
public ThreadedSeedGenerator()

Method Detail

generateSeedback to summary
public byte[] generateSeed(int numBytes, boolean fast)

Generate seed bytes. Set fast to false for best quality.

If fast is set to true, the code should be round about 8 times faster when generating a long sequence of random bytes. 20 bytes of random values using the fast mode take less than half a second on a Nokia e70. If fast is set to false, it takes round about 2500 ms.

Parameters
numBytes:int

the number of bytes to generate

fast:boolean

true if fast mode should be used

org.bouncycastle.crypto.prng back to summary

private Class ThreadedSeedGenerator.SeedGenerator

extends Object
implements Runnable
Class Inheritance
  • java.lang.Object
  • org.bouncycastle.crypto.prng.ThreadedSeedGenerator.SeedGenerator
All Implemented Interfaces
java.lang.Runnable

Field Summary

Modifier and TypeField and Description
private volatile int
private volatile boolean

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public byte[]
generateSeed(int numbytes, boolean fast)

public void
run()

Implements java.lang.Runnable.run.

Runs this operation.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

counterback to summary
private volatile int counter
stopback to summary
private volatile boolean stop

Constructor Detail

SeedGeneratorback to summary
private SeedGenerator()

Method Detail

generateSeedback to summary
public byte[] generateSeed(int numbytes, boolean fast)
runback to summary
public void run()

Implements java.lang.Runnable.run.

Doc from java.lang.Runnable.run.

Runs this operation.