bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#6658: [PATCH] randread: use /dev/urandom to seed, not just getpid et


From: Pádraig Brady
Subject: bug#6658: [PATCH] randread: use /dev/urandom to seed, not just getpid etc
Date: Wed, 21 Jul 2010 00:18:39 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.8) Gecko/20100227 Thunderbird/3.0.3

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.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]