Re: Random strings

From: "Joe Conway" <joseph(dot)conway(at)home(dot)com>
To: "Peter Eisentraut" <peter_e(at)gmx(dot)net>
Cc: "Dr(dot) Evil" <drevil(at)sidereal(dot)kz>, <pgsql-patches(at)postgresql(dot)org>
Subject: Re: Random strings
Date: 2001-08-09 17:13:18
Message-ID: 010901c120f6$9615cfa0$48d210ac@jecw2k1
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-patches

> > seconds). The same test with /dev/urandom returns instantly. Perhaps
there
> > should be an option to use either. For instances where only a few truly
> > random bytes is needed (i.e. one session key), use /dev/random. When you
> > need many random bytes quickly, use /dev/urandom?
>
> Not sure if this is intuitive. How many bytes is "a few"? Maybe just be
> honest about it and name them randomstr and urandomstr or such.
>

In the patch that I sent last night, I explicitly limited /dev/random to 64
bytes. I agree that this is not very intuitive, but for specific purposes,
such as generating a session key for tripledes (24 byte/192 bit random
string yielding 168 bits for a the key) periodically, it is quite useful.
There's a tradeoff here between cryptographic strength (favoring
/dev/random) and application performance (favoring /dev/urandom) that will
vary significantly from application to application. It's nice to have the
option depending on your needs.

Having said that, I'm not married to the idea that we should provide access
to both /dev/random and /dev/urandom. I'd be happy to roll another patch,
limited to just urandom, and renaming the function if you feel strongly
about it. (should we move this discussion back to hackers to get a wider
audience?)

-- Joe

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Brian C. Doyle 2001-08-09 17:35:58 UpGrading to 7.1.2
Previous Message Peter Eisentraut 2001-08-09 16:23:23 Re: Re: First Saturday and Last Saturday of a month

Browse pgsql-patches by date

  From Date Subject
Next Message Mikhail Terekhov 2001-08-09 19:08:12 Re: Re: WIN32 errno patch
Previous Message Peter Eisentraut 2001-08-09 15:35:13 Re: Random strings