How can i create a DETERMINISTIC, seeded random source?

I tried various examples from the wiki, like the one below, and none
of them generates the same block twice.

What am I missing?


const unsigned int SEEDSIZE = 16;
byte pcbSeed[ SEEDSIZE ];

const unsigned int BLOCKSIZE = 16 * 8;
byte pcbScratch[ BLOCKSIZE ];

//Set the seed to "xxxx...x"
for(size_t i = 0; i < SEEDSIZE; ++i) {
    pcbSeed[i] =  (byte)'x';
}

CryptoPP::RandomPool rng;
// also tried
// CryptoPP::AutoSeededX917RNG<CryptoPP::DES_EDE3> rng(true, false);

rng.CanIncorporateEntropy() //This is true in both cases

rng.IncorporateEntropy( pcbSeed, SEEDSIZE );

rng.GenerateBlock( pcbScratch, BLOCKSIZE );


The content of pcbScratch change at each invocation, i.e.

7130613e450cf4ab478b0804bca41f98adbaabfbfe1c85cefdec1ee70b36f799773e128004d8cad178497b9cb218be0191710626eee5317ced25c628ade257441a22cfe3bd96f95ec45b76be852a375cdd659a37a0c1f677564b94e09cb4a62f18f847b7564b3ece90da1bb02d6566c1ec492d815e1078cbb389995c71048f92

then

95e7aa283c1b6b0994ea68acd16086696f871b4904f019a8ee2325840c0e3eaf720303fa7b9997a3ce4fbc1f7bfde4c870bc4c0bbb1d18129201d74e74ef7ea8344d87c9691da47ea605bc11fc45b9d2bd5e44dcc3f505be8ac96f3616351b7251434597e747e90a4924f5e4abaf497a7deec54ed831a849ea04e3fd7f5a9eb5


Example is from
http://www.cryptopp.com/fom-serve/cache/83.html
http://www.codeproject.com/KB/cpp/PRNG.aspx?q=%2bcryptopp+PRNG+deterministic

-- 
You received this message because you are subscribed to the "Crypto++ Users" 
Google Group.
To unsubscribe, send an email to [email protected].
More information about Crypto++ and this group is available at 
http://www.cryptopp.com.

Reply via email to