Messages in this thread |  | | | From | Ian Campbell <> | | Date | Tue, 01 Jun 2010 14:03:07 +0100 | | Subject | Re: 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.
|  |