com.mindbright.util
public class SecureRandomAndPad extends java.security.SecureRandom
Constructor and Description |
---|
SecureRandomAndPad()
Simple constructor.
|
SecureRandomAndPad(byte[] seed) |
SecureRandomAndPad(java.security.SecureRandom random)
Creates an instance which uses the given random number
generator.
|
Modifier and Type | Method and Description |
---|---|
byte[] |
generateSeed(int numBytes)
Generate random seed bytes.
|
void |
nextBytes(byte[] bytes)
Fills the given array with random bytes.
|
void |
nextPadBytes(byte[] bytes,
int off,
int len)
Get a number of pad bytes.
|
void |
setPadSeed(byte[] seed)
Seed the pad generator.
|
void |
setSeed(byte[] seed)
Seeds the random number generator.
|
getAlgorithm, getInstance, getInstance, getInstance, getProvider, getSeed, next, setSeed
public SecureRandomAndPad()
public SecureRandomAndPad(byte[] seed)
public SecureRandomAndPad(java.security.SecureRandom random)
random
- underlying random number generatorpublic void setPadSeed(byte[] seed)
seed
- array of random data which is used to seed the generatorpublic void nextPadBytes(byte[] bytes, int off, int len)
bytes
- array into which the bytes should be storedoff
- offset to first byte to store in arraylen
- number of pad bytes to storepublic byte[] generateSeed(int numBytes)
generateSeed
in class java.security.SecureRandom
numBytes
- how many bytes to generatepublic void nextBytes(byte[] bytes)
nextBytes
in class java.security.SecureRandom
bytes
- array to fill with random bytespublic void setSeed(byte[] seed)
setSeed
in class java.security.SecureRandom
seed
- array of random data which is used to seed the generator