#include <src/main/decaf/security/SecureRandom.h>
Public Member Functions |
| SecureRandom () |
| Creates a new instance of a secure random number generator that implements the default random number algorithm.
|
| SecureRandom (const std::vector< unsigned char > &seed) |
| Creates a new instance of a secure random number generator that implements the default random number algorithm.
|
| SecureRandom (const unsigned char *seed, int size) |
| Creates a new instance of a secure random number generator that implements the default random number algorithm.
|
virtual | ~SecureRandom () |
virtual void | nextBytes (std::vector< unsigned char > &buf) |
| Modifies the byte array by a random sequence of bytes generated by this random number generator.- Parameters:
-
buf | non-null array to contain the new random bytes |
- See also:
- next
|
virtual void | nextBytes (unsigned char *buf, int size) |
| Modifies the byte array by a random sequence of bytes generated by this random number generator.- Parameters:
-
buf | non-null array to contain the new random bytes |
- See also:
- next
- Exceptions:
-
NullPointerException | if buff is NULL |
IllegalArgumentException | if size is negative |
|
virtual void | setSeed (unsigned long long seed) |
| Modifies the seed using linear congruential formula presented in The Art of Computer Programming, Volume 2, Section 3.2.1.- Parameters:
-
seed | the seed that alters the state of the random number generator |
- See also:
- next
-
Random()
-
#Random(long)
|
virtual void | setSeed (const std::vector< unsigned char > &seed) |
| Supplements or sets the seed of this secure random number generator, calls to this method never reduces randomness.
|
virtual void | setSeed (const unsigned char *seed, int size) |
| Supplements or sets the seed of this secure random number generator, calls to this method never reduces randomness.
|
Protected Member Functions |
virtual int | next (int bits) |
| Answers a pseudo-random uniformly distributed int value of the number of bits specified by the argument bits as described by Donald E.Knuth in The Art of Computer Programming, Volume 2: Seminumerical Algorithms, section 3.2.1.- Returns:
- int a pseudo-random generated int number
- Parameters:
-
bits | number of bits of the returned value |
- See also:
- nextBytes
-
nextDouble
-
nextFloat
-
nextInt()
-
nextInt(int)
-
nextGaussian
-
nextLong
|
Detailed Description
Constructor & Destructor Documentation
decaf::security::SecureRandom::SecureRandom |
( |
| ) |
|
Creates a new instance of a secure random number generator that implements the default random number algorithm.
The SecureRandom instance that is created with this constructor is unseeded and can be seeded by calling the setSeed method. Calls to nextBytes on an unseeded SecureRandom result in the object seeding itself.
decaf::security::SecureRandom::SecureRandom |
( |
const std::vector< unsigned char > & |
seed | ) |
|
Creates a new instance of a secure random number generator that implements the default random number algorithm.
The SecureRandom instance created by this constructor is seeded using the passed byte array.
- Parameters:
-
seed | The seed bytes to use to seed this secure random number generator. |
decaf::security::SecureRandom::SecureRandom |
( |
const unsigned char * |
seed, |
|
|
int |
size |
|
) |
| |
Creates a new instance of a secure random number generator that implements the default random number algorithm.
The SecureRandom instance created by this constructor is seeded using the passed byte array.
- Parameters:
-
seed | The seed bytes to use to seed this secure random number generator. |
size | The number of bytes in the seed buffer. |
- Exceptions:
-
NullPointerException | if the seed buffer is NULL. |
IllegalArgumentException | if the size value is negative. |
virtual decaf::security::SecureRandom::~SecureRandom |
( |
| ) |
[virtual] |
Member Function Documentation
virtual int decaf::security::SecureRandom::next |
( |
int |
bits | ) |
[protected, virtual] |
Answers a pseudo-random uniformly distributed int
value of the number of bits specified by the argument bits
as described by Donald E.Knuth in The Art of Computer Programming, Volume 2: Seminumerical Algorithms, section 3.2.1.
- Returns:
- int a pseudo-random generated int number
- Parameters:
-
bits | number of bits of the returned value |
- See also:
- nextBytes
-
nextDouble
-
nextFloat
-
nextInt()
-
nextInt(int)
-
nextGaussian
-
nextLong
Reimplemented from decaf::util::Random.
virtual void decaf::security::SecureRandom::nextBytes |
( |
unsigned char * |
buf, |
|
|
int |
size |
|
) |
| [virtual] |
Modifies the byte array by a random sequence of bytes generated by this random number generator.
- Parameters:
-
buf | non-null array to contain the new random bytes |
- See also:
- next
- Exceptions:
-
NullPointerException | if buff is NULL |
IllegalArgumentException | if size is negative |
Reimplemented from decaf::util::Random.
virtual void decaf::security::SecureRandom::nextBytes |
( |
std::vector< unsigned char > & |
buf | ) |
[virtual] |
Modifies the byte array by a random sequence of bytes generated by this random number generator.
- Parameters:
-
buf | non-null array to contain the new random bytes |
- See also:
- next
Reimplemented from decaf::util::Random.
virtual void decaf::security::SecureRandom::setSeed |
( |
const std::vector< unsigned char > & |
seed | ) |
[virtual] |
Supplements or sets the seed of this secure random number generator, calls to this method never reduces randomness.
- Parameters:
-
seed | A vector of bytes that is used update the seed of the RNG. |
virtual void decaf::security::SecureRandom::setSeed |
( |
const unsigned char * |
seed, |
|
|
int |
size |
|
) |
| [virtual] |
Supplements or sets the seed of this secure random number generator, calls to this method never reduces randomness.
- Parameters:
-
seed | The seed bytes to use to seed this secure random number generator. |
size | The number of bytes in the seed buffer. |
- Exceptions:
-
NullPointerException | if the seed buffer is NULL. |
IllegalArgumentException | if the size value is negative. |
virtual void decaf::security::SecureRandom::setSeed |
( |
unsigned long long |
seed | ) |
[virtual] |
Modifies the seed using linear congruential formula presented in The Art of Computer Programming, Volume 2, Section 3.2.1.
- Parameters:
-
seed | the seed that alters the state of the random number generator |
- See also:
- next
-
Random()
-
#Random(long)
Reimplemented from decaf::util::Random.
The documentation for this class was generated from the following file: