public class JDKSeedGenerator extends VarLengthSeedGenerator
JDKSeedGenerator.setSecureRandom(SecureRandom)
. This is recommended,
if the SecureRandom selected by default does not generate a secure seed.
It can generate as many bytes as you need, but it is fairly slow. That
process is started when you call getSeed(). Per default this class generates
a 256 bit seed (32 bytes).seedGenListener
Constructor and Description |
---|
JDKSeedGenerator()
Initialize generation of a seed with the default amount of randomness (256
bit).
|
JDKSeedGenerator(int numBits)
Initialize generation of a seed with the specified number of bits of
randomness.
|
Modifier and Type | Method and Description |
---|---|
static java.security.SecureRandom |
getSecureRandom()
Returns the SecureRandom instance that is in use by all JDKSeedGenerator
instances.
|
byte[] |
getSeed()
Return the seed.
|
int[] |
getStatus()
Return the status of seed generation.
|
static void |
setSecureRandom(java.security.SecureRandom random)
Sets the SecureRandom instance to be used by all JDKSeedGenerator
instances.
|
getDefault, getSeedLength, hasSeedLengthChanged, reinit, setDefault, setSeedLength
callSeedGenListener, getDefault, getDefaultSeedGenerator, seedAvailable, setDefaultSeedGenerator, setSeedGenListener
public JDKSeedGenerator()
public JDKSeedGenerator(int numBits)
public int[] getStatus()
{numBits, numBits}
, i.e. it is always ok to call getSeed().getStatus
in class SeedGenerator
public byte[] getSeed()
getSeed
in class SeedGenerator
public static void setSecureRandom(java.security.SecureRandom random)
random
- the SecureRandom instancepublic static java.security.SecureRandom getSecureRandom()