linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ron Peterson <rpeterso@mtholyoke.edu>
To: Robert Love <rml@novell.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: /dev/random vs. /dev/urandom
Date: Fri, 7 Jan 2005 15:50:31 -0500	[thread overview]
Message-ID: <20050107205031.GA14599@mtholyoke.edu> (raw)
In-Reply-To: <1105126843.9311.41.camel@betsy.boston.ximian.com>

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

  reply	other threads:[~2005-01-07 20:53 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-07 19:05 /dev/random vs. /dev/urandom Ron Peterson
2005-01-07 19:16 ` Paulo Marques
2005-01-07 19:24 ` Chris Friesen
2005-01-07 19:26 ` Florian Weimer
2005-01-07 19:27 ` linux-os
2005-01-07 19:40 ` Robert Love
2005-01-07 20:50   ` Ron Peterson [this message]
2005-01-07 21:39 ` Andries Brouwer
2005-01-07 22:39   ` linux-os
2005-01-07 17:55     ` Michal Schmidt
2005-01-07 23:29     ` Andries Brouwer
2005-01-08 17:34     ` Patrick J. LoPresti
2005-01-10 12:41       ` linux-os
2005-01-10 13:03         ` Paulo Marques
2005-01-10 14:39           ` Felipe Alfaro Solana
2005-01-10 15:13         ` Patrick J. LoPresti
2005-01-10 19:24         ` David Schwartz
2005-01-11 14:38         ` Andrea Arcangeli

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050107205031.GA14599@mtholyoke.edu \
    --to=rpeterso@mtholyoke.edu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rml@novell.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).