From: hpa@zytor.com (H. Peter Anvin)
To: linux-raid@vger.kernel.org
Subject: Re: Forcing a more random uuid (random seed bug)
Date: Tue, 22 Feb 2005 23:58:06 +0000 (UTC) [thread overview]
Message-ID: <cvggue$73n$1@terminus.zytor.com> (raw)
In-Reply-To: 20050208140538.12557.qmail@science.horizon.com
Followup to: <20050208140538.12557.qmail@science.horizon.com>
By author: linux@horizon.com
In newsgroup: linux.dev.raid
>
> + if ((my_fd = open("/dev/random", O_RDONLY)) != -1) {
>
> Please use /dev/urandom for such applications. /dev/random is the
> highest-quality generator, but will block if entropy isn't available.
> /dev/urandom provides the best available, immediately, which is what
> this application wants.
Not 100% clear; the best would be to make it configurable.
Either way you must not use read() in the way described. Short reads
happen, even with /dev/urandom.
> Also, this will only produce 2^32 possible UUIDs, since that's the
> size of the seed. Meaning that after you've generated 2^16 of them,
> the chances are excellent that they're not UU any more.
>
> You might just want to get all 128 (minus epsilon) bits from /dev/urandom
> directly.
You *do* want to get all bits from /dev/urandom directly.
-hpa
next prev parent reply other threads:[~2005-02-22 23:58 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-02-08 14:05 Forcing a more random uuid (random seed bug) linux
2005-02-22 23:58 ` H. Peter Anvin [this message]
-- strict thread matches above, loose matches on Subject: below --
2005-02-01 17:47 Forcing a more random uuid Niccolo Rigacci
2005-02-02 13:33 ` Forcing a more random uuid (random seed bug) Niccolo Rigacci
2005-02-22 23:55 ` H. Peter Anvin
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='cvggue$73n$1@terminus.zytor.com' \
--to=hpa@zytor.com \
--cc=linux-raid@vger.kernel.org \
/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).