lkml.org 
[lkml]   [2010]   [Jun]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: constant half-byte from /proc/sys/kernel/random/uuid
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.



\
 
 \ /
  Last update: 2010-06-01 15:19    [from the cache]
©2003-2014 Jasper Spaans. Advertise on this site