Re: Forcing a more random uuid (random seed bug)

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

 



Followup to:  <20050208140538.12557.qmail@xxxxxxxxxxxxxxxxxxx>
By author:    linux@xxxxxxxxxxx
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
-
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux