de.bb.security
Class SecureRandom
java.lang.Object
|
+--java.util.Random
|
+--de.bb.security.SecureRandom
- All Implemented Interfaces:
- java.io.Serializable
- public class SecureRandom
- extends java.util.Random
This class provides a crytpographically strong pseudo-random number
generator based on the SHA-1 hash algorithm.
The calls inherited from Random will be implemented in terms of the
strengthened functionality.
- See Also:
Random, Serialized Form
|
Method Summary |
protected int |
next(int bits)
generate the next random bits |
void |
setSeed(byte[] b)
Set a new seed. |
void |
setSeed(long l)
Set a new seed. |
| Methods inherited from class java.util.Random |
nextBoolean, nextBytes, nextDouble, nextFloat, nextGaussian, nextInt, nextInt, nextLong |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
instance
public static final SecureRandom instance
SecureRandom
public SecureRandom()
- ct of SecureRandom
setSeed
public final void setSeed(long l)
- Set a new seed. Even setting the same seed again,
this will *NOT* reproduce the same random values!
- Overrides:
setSeed in class java.util.Random
- Parameters:
l - - the long to add to the seed
setSeed
public final void setSeed(byte[] b)
- Set a new seed. Even setting the same seed again,
this will *NOT* reproduce the same random values!
- Parameters:
b - - the byte array to add to the seed;
next
protected final int next(int bits)
- generate the next random bits
- Overrides:
next in class java.util.Random
- Parameters:
bits - - count of new generated bits- Returns:
- an integer containing the generated random bits