Zooko, the functionality you want is already in Crypto++. Just do this:

SecByteBlock seed;
// fill seed here
r.GenerateRandom(NullRNG(), MakeParameters(Name::Min(), 1)(Name::Max(), 
n)(Name::Seed(), ConstByteArrayParameter(seed)));

This will be supported and be backwards compatible indefinitely. Internally 
it will use P1363_KDF2<SHA1> to generate random integers that are the same 
length as n-1, until one of them is less than n-1, then it returns that 
number plus 1. Not too different from your code, actually.
 


--~--~---------~--~----~------------~-------~--~----~
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