LC_RNG isn't secure, so shouldn't be used except for testing. Many stream
ciphers implement the RandomNumberGenerator interface, and can be used as
secure deterministic random number generators. Sosemanuk would be a good
choice for this. CTR_Mode<AES> should also work, but there's a bug (which
will be fixed soon) that makes the RandomNumberGenerator interface
inaccessible.
Also, there's actually a built-in, but undocumented, feature for generating
a random integer directly from a seed. Here's the code:
Integer i;
cout<<"Please Enter an Integer:";
cin>>i;
Integer r;
SecByteBlock b(i.ByteCount());
i.Encode(b, b.size());
r.GenerateRandom(NullRNG(), MakeParameters("BitLength", 4)(Name::Seed(),
ConstByteArrayParameter(b)));
cout<<r<<endl;
--------------------------------------------------
From: "Jens Peter Secher" <[email protected]>
Sent: Tuesday, February 24, 2009 8:49 AM
To: "Crypto++ Users" <[email protected]>
Subject: Re: RandomPool and Integer Randomize Problem
>
> 2009/2/24 Gung Shi Jie <[email protected]>:
>>
>> Hi, is generating a deterministic random number possible in CryptoPP?
>>
>
> Yes, LC_RNG.
> --
> Jens Peter Secher.
> _DD6A 05B0 174E BFB2 D4D9 B52E 0EE5 978A FE63 E8A1 jpsecher gmail com_.
> A. Because it breaks the logical sequence of discussion.
> Q. Why is top posting bad?
>
> >
--~--~---------~--~----~------------~-------~--~----~
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.
-~----------~----~----~----~------~----~------~--~---