[prev in list] [next in list] [prev in thread] [next in thread] 

List:       coreutils-bug
Subject:    bug#6658: [PATCH] randread: use /dev/urandom to seed,
From:       Pádraig Brady <P () draigBrady ! com>
Date:       2010-07-20 23:18:39
Message-ID: 4C462ECF.2000401 () draigBrady ! com
[Download RAW message or body]

On 20/07/10 17:59, Paul Eggert wrote:
> OK, I installed part (2) of the patch: it uses /dev/urandom
> rather than the getpid()/gettimeofday() yucky stuff,
> when /dev/urandom is available.

/dev/urandom is very widely available,
so this should work for most systems.

> One downside to this patch is that on hosts where mkstemp
> doesn't work and we're using our substitute, each invocation
> of mkstemp opens /dev/urandom, reads a few bytes, and closes it.
> I don't view this as a big problem, because (a) it's only for
> hosts with broken mkstemp and they should fix their mkstemp and
> (b) creating a temp file is a big-deal operation anyway and
> the extra overhead of opening /dev/urandom doesn't add much.

I agree. Running a million iterations of each seeder:
  orig				3s
  new (1 byte from urandom)	8s
  new (16 bytes from urandom)	11s

The patch looks good.

cheers,
Pádraig.



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic