lkml.org 
[lkml]   [2005]   [Jan]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: /dev/random vs. /dev/urandom
On Fri, Jan 07, 2005 at 02:40:43PM -0500, Robert Love wrote:
> On Fri, 2005-01-07 at 14:05 -0500, Ron Peterson wrote:
>
> > read( fd, dat, RAND_LEN );
> > for( i = 0; i < RAND_LEN; i++ ) {
> > dat[i] = (dat[i] & 0x07) + '0';
> > }
>
> Your problem is probably because read() need not actually read RAND_LEN
> bytes. Particularly with /dev/random, since it will only return bytes
> up to the entropy estimate. But you assume it read RAND_LEN, when those
> are unread. And possibly zero. So that is probably your bug.
>
> The AND makes zero sense, either.
>
> Just use dd(1).

Ah, thanks! (to you and everyone else.)

(I can't use dd because I want to use the value to feed gmp_randseed
from gmp library. I need the AND to create the proper ascii code for a
numeral.)

Best.

--
Ron Peterson
Network & Systems Manager
Mount Holyoke College
http://www.mtholyoke.edu/~rpeterso
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 14:09    [W:0.356 / U:0.044 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site