|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.util.Random
java.security.SecureRandom
com.mindbright.util.SecureRandomAndPad
public class SecureRandomAndPad
Class for generating both random bytes and pad bytes. The pad bytes are also pseudo-random but generated by a different algorithm (arcfour) and uses a different seed.
| Constructor Summary | |
|---|---|
SecureRandomAndPad()
Simple constructor. |
|
SecureRandomAndPad(byte[] seed)
|
|
SecureRandomAndPad(java.security.SecureRandom random)
Creates an instance which uses the given random number generator. |
|
| Method Summary | |
|---|---|
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. |
| Methods inherited from class java.security.SecureRandom |
|---|
getAlgorithm, getInstance, getInstance, getInstance, getProvider, getSeed, next, setSeed |
| Methods inherited from class java.util.Random |
|---|
nextBoolean, nextDouble, nextFloat, nextGaussian, nextInt, nextInt, nextLong |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public SecureRandomAndPad()
public SecureRandomAndPad(byte[] seed)
public SecureRandomAndPad(java.security.SecureRandom random)
random - underlying random number generator| Method Detail |
|---|
public void setPadSeed(byte[] seed)
seed - array of random data which is used to seed the generator
public 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.SecureRandomnumBytes - how many bytes to generate
public void nextBytes(byte[] bytes)
nextBytes in class java.security.SecureRandombytes - array to fill with random bytespublic void setSeed(byte[] seed)
setSeed in class java.security.SecureRandomseed - array of random data which is used to seed the generator
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||