dimanche 15 février 2015

How to regenerate values in AutoSeededX917RNG

I need to regenerate the pseuorandom values when I need them. My code is:



static const unsigned int BLOCKSIZE = 5;
byte scratch[ BLOCKSIZE ];

CryptoPP::AutoSeededX917RNG<CryptoPP::AES> rng;
rng.GenerateBlock(scratch,BLOCKSIZE);

std::cout << "The generated random block is:" << std::endl;
for( unsigned int i = 0; i < BLOCKSIZE; i++ )
{
std::cout << std::setw(2) << std::setfill('0');
std::cout << static_cast<unsigned int>( scratch[ i ] );
}
std::cout << std::endl;

Aucun commentaire:

Enregistrer un commentaire