|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.ibm.security12.java.security.SecureRandomSpi | +--com.ibm.security12.sun.security.provider.SecureRandom
This class provides a crytpographically strong pseudo-random number generator based on the SHA-1 hash algorithm.
Note that if a seed is not provided, we attempt to provide sufficient seed bytes to completely randomize the internal state of the generator (20 bytes). However, our seed generation algorithm has not been thoroughly studied or widely deployed.
Also note that when a random object is deserialized, engineNextBytes invoked on the restored random object will yield the exact same (random) bytes as the original object. If this behaviour is not desired, the restored random object should be seeded, using engineSetSeed.
Constructor Summary | |
SecureRandom()
This empty constructor automatically seeds the generator. |
Method Summary | |
byte[] |
engineGenerateSeed(int numBytes)
Returns the given number of seed bytes, computed using the seed generation algorithm that this class uses to seed itself. |
void |
engineNextBytes(byte[] result)
Generates a user-specified number of random bytes. |
void |
engineSetSeed(byte[] seed)
Reseeds this random object. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Constructor Detail |
public SecureRandom()
The first time this constructor is called in a given Virtual Machine, it may take several seconds of CPU time to seed the generator, depending on the underlying hardware. Successive calls run quickly because they rely on the same (internal) pseudo-random number generator for their seed bits.
Method Detail |
public byte[] engineGenerateSeed(int numBytes)
numBytes
- the number of seed bytes to generate.public void engineSetSeed(byte[] seed)
seed
- the seed.public void engineNextBytes(byte[] result)
bytes
- the array to be filled in with random bytes.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |