From: Ian Campbell <ijc@hellion.org.uk>
To: Petr Ovtchenkov <ptr@void-ptr.info>
Cc: linux-kernel@vger.kernel.org
Subject: Re: constant half-byte from /proc/sys/kernel/random/uuid
Date: Tue, 01 Jun 2010 14:03:07 +0100 [thread overview]
Message-ID: <1275397387.24218.20972.camel@zakaz.uk.xensource.com> (raw)
In-Reply-To: <201006011622.58834.ptr@void-ptr.info>
On Tue, 2010-06-01 at 16:22 +0400, Petr Ovtchenkov wrote:
> Lack of randomness during generating uuid.
[...]
> See on 7th high half-byte: it '4' in
> all cases---4b, 42, 40, 43, 49, 41,
> 4b, 4b, 4e. Checked three comps, with
> similar results. All Linux-generated UUID (boot_id)
> that I see in internet has '4' in this
> half-byte.
This appears to be deliberate. From drivers/char/random.c:
void generate_random_uuid(unsigned char uuid_out[16])
{
get_random_bytes(uuid_out, 16);
/* Set UUID version to 4 --- truly random generation */
uuid_out[6] = (uuid_out[6] & 0x0F) | 0x40;
/* Set the UUID variant to DCE */
uuid_out[8] = (uuid_out[8] & 0x3F) | 0x80;
}
EXPORT_SYMBOL(generate_random_uuid);
Version 4 UUIDs and the format used are described at
http://en.wikipedia.org/wiki/Universally_Unique_Identifier
Ian.
--
Ian Campbell
Current Noise: Jesu - Your Path To Divinity
Build a system that even a fool can use and only a fool will want to use it.
prev parent reply other threads:[~2010-06-01 13:16 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-01 12:22 Petr Ovtchenkov
2010-06-01 12:52 ` Lukasz Gromanowski
2010-06-01 13:03 ` Ian Campbell [this message]
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=1275397387.24218.20972.camel@zakaz.uk.xensource.com \
--to=ijc@hellion.org.uk \
--cc=linux-kernel@vger.kernel.org \
--cc=ptr@void-ptr.info \
/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
all inboxes | Powered by JetHome®