RandomNumberSource takes a pointer to a
BufferedTransformation. Because a pointer is taken, the
RandomNumberSource owns the attached transformation, and therefore will destroy it. See ownership for more details.
RandomNumberSource (RandomNumberGenerator &rng, int length, bool pumpAll, BufferedTransformation *attachment=NULL)
rng is a
length is the number of bytes to generate.
pumpAll is a flag indicating the source should pump all of its data.
attachment is an attached
The example below places 8 random bytes of data into a StringSink after Hex Encoding. The code uses a StringSink and
string to hold sensitive material. Though convenient, the practice is not a very good idea - see Keys and Formats for details.
AutoSeededRandomPool rng; RandomNumberSource( rng, 8, true, new HexEncoder( new CryptoPP::StringSink( s ) ) // HexEncoder ); // RandomNumberSource