Use of AutoSeededRandomPool

273 views
Skip to first unread message

dreijer

unread,
Dec 28, 2006, 7:30:31 PM12/28/06
to Crypto++ Users
Hey,

I'm wondering whether it's okay just to instantiate a single, global
AutoSeededRandomPool in your application that is used by all the
various crypto algorithms or whether it's better to instantiate a new
AutoSeededRandomPool every time you need it (such as one for creating a
random nonce and another one when calling RSA's Encrypt() method).

Soren

Jeffrey Walton

unread,
Dec 29, 2006, 1:28:28 AM12/29/06
to Crypto++ Users
Hi Soren,

A GlobalPRNG should be fine. Unless of course design requirements
dictate each thread receive it's own PRNG, etc.

I actually prefer the Global method since ASRP uses OS entropy to seed
itself (on Windows). I think it is possible to go to the well once to
often when using the underlying OS function. That is, a per thread or
per needed may tax the systems ability to deliver psuedo random bytes.

Jeff

Wei Dai

unread,
Dec 29, 2006, 3:09:16 AM12/29/06
to Crypto++ Users
Jeffrey Walton wrote:
> A GlobalPRNG should be fine. Unless of course design requirements
> dictate each thread receive it's own PRNG, etc.

I suggest one instance per thread so you don't have to worry about
synchronizing access to it. One instance per use is fine also if that
is more convenient. The extra system overhead is probably unnoticeable
in most situations.

Jeffrey Walton

unread,
Dec 29, 2006, 4:10:57 AM12/29/06
to Wei Dai, Crypto++ Users
Hi Wei,
 
| synchronizing access...
Very good observation. I to did not occur to me. I was thinking more along the lines of LCGs so you could reproduce results from one run to the next during debugging.
 
Jeff
Reply all
Reply to author
Forward
0 new messages