Virgil Security Crypto library  2.5.0-rc1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
Static Public Member Functions | List of all members
virgil::crypto::foundation::VirgilRandom Class Reference

Provides randomization algorithm. More...

#include <VirgilRandom.h>

Public Member Functions

Creation / Destruction methods
 VirgilRandom (const virgil::crypto::VirgilByteArray &personalInfo)
 Initialize randomization module with personalization data. More...
 
 VirgilRandom (const std::string &personalInfo)
 Initialize randomization module with personalization data. More...
 
Randomization
virgil::crypto::VirgilByteArray randomize (size_t bytesNum)
 Produce random byte sequence. More...
 
size_t randomize ()
 
size_t randomize (size_t min, size_t max)
 

Static Public Member Functions

static void setSeedFile (std::string path)
 Configure path to the file that is used as a seed for a non-volatile entropy source. More...
 
static size_t seedFileLengthMin ()
 

Detailed Description

Provides randomization algorithm.

Constructor & Destructor Documentation

virgil::crypto::foundation::VirgilRandom::VirgilRandom ( const virgil::crypto::VirgilByteArray personalInfo)
explicit

Initialize randomization module with personalization data.

Parameters
personalInfo(
See Also
section 8.7.1 of NIST Special Publication 800-90A).
virgil::crypto::foundation::VirgilRandom::VirgilRandom ( const std::string &  personalInfo)
explicit

Initialize randomization module with personalization data.

Parameters
personalInfo(
See Also
section 8.7.1 of NIST Special Publication 800-90A).

Member Function Documentation

virgil::crypto::VirgilByteArray virgil::crypto::foundation::VirgilRandom::randomize ( size_t  bytesNum)

Produce random byte sequence.

Parameters
bytesNumnumber of bytes to be generated.
Returns
Random byte sequence.
size_t virgil::crypto::foundation::VirgilRandom::randomize ( )

Returns a pseudo-random number.

Returns
Random Number
size_t virgil::crypto::foundation::VirgilRandom::randomize ( size_t  min,
size_t  max 
)

Returns a pseudo-random number between min and max, inclusive.

The difference between min and max can be at most std::numeric_limits<size_t>::max() - 1.

Parameters
min- minimum value.
max- maximum value. Must be greater than min.
Returns
Number between min and max, inclusive.
static size_t virgil::crypto::foundation::VirgilRandom::seedFileLengthMin ( )
static

Return minimum length of the seed file.

Exceptions
VirgilCryptoExceptionwith VirgilCryptoErrorCode::UnsupportedAlgorithm, if library is build without feature: VIRGIL_CRYPTO_FEATURE_RNG_SEED_FILE.
Returns
minimum seed file length in bytes.
static void virgil::crypto::foundation::VirgilRandom::setSeedFile ( std::string  path)
static

Configure path to the file that is used as a seed for a non-volatile entropy source.

Parameters
paththe path to the file.
Exceptions
VirgilCryptoExceptionwith VirgilCryptoErrorCode::EmptyParameter, if path is empty.
VirgilCryptoExceptionwith VirgilCryptoErrorCode::FileNotFound, if file at given path can not be read.
VirgilCryptoExceptionwith VirgilCryptoErrorCode::UnsupportedAlgorithm, if library is build without feature: VIRGIL_CRYPTO_FEATURE_RNG_SEED_FILE.

The documentation for this class was generated from the following file: