com.jcorporate.expresso.core.security.strongencryption
Class RandomNumber
java.lang.Object
com.jcorporate.expresso.core.security.AbstractRandomNumber
com.jcorporate.expresso.core.security.strongencryption.RandomNumber
- public final class RandomNumber
- extends AbstractRandomNumber
Cryptographically Strong Version of the random number generator.
Due to the seeding process, the constructor for this class will
take a significant amount of time to initialize.
- Author:
- Michael Rimov
|
Method Summary |
byte[] |
getRandomBytes(int numBytes)
getRandomBytes - Returns a byte array of random bytes. |
void |
init()
To save some time, we use the last seed generated from a file instead
of loading from scratch |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
RandomNumber
public RandomNumber()
throws ChainedException
- Default Constructor
- Throws:
ChainedException - if unable to instantiate the SHA1 Random
number generator
init
public void init()
throws ChainedException
- To save some time, we use the last seed generated from a file instead
of loading from scratch
- Overrides:
init in class AbstractRandomNumber
- Throws:
NoSuchAlgorithmException - if we cannot find the SHA1PRNG
ChainedException
getRandomBytes
public byte[] getRandomBytes(int numBytes)
- getRandomBytes - Returns a byte array of random bytes. The derived
class determines the actual method used for getting the random data.
- Specified by:
getRandomBytes in class AbstractRandomNumber
- Parameters:
numBytes - The number of bytes to retrieve
- Returns:
- An array of random bytes
Please see www.jcorporate.com for information about new Expresso releases.