[Development] QUuid documentation
thiago.macieira at intel.com
Thu Sep 8 17:16:27 CEST 2016
On quinta-feira, 8 de setembro de 2016 11:35:22 PDT Benjamin TERRIER wrote:
> As of Qt 5.7, QUuid::createUuid() documentation is:
> > On any platform other than Windows, this function returns a new UUID with
> > variant QUuid::DCE and version QUuid::Random. If the /dev/urandom device
> > exists, then the numbers used to construct the UUID will be of
> > cryptographic quality, which will make the UUID unique. Otherwise, the
> > numbers of the UUID will be obtained from the local pseudo-random number
> > generator (qrand(), which is seeded by qsrand()) which is usually not of
> > cryptograhic quality, which means that the UUID can't be guaranteed to be
> > unique.
> > On a Windows platform, a GUID is generated, which almost certainly will be
> > unique, on this or any other system, networked or not.
> So according to this there are 3 kinds of UUID:
> - Generated by /dev/urandom
> - Generated by qrand()
> - Generated on Windows OS
> The documentation states explicitly that the first type is unique and
> that the 2 last types are not unique.
It says that the first and the last are unique, the middle one isn't.
> However, my knowledge is that whatever the method one use to generate
> your UUID, one can never guarantee its uniqueness. Meaning that the Qt
> documentation is falsely guarantying unique UUID and therefore should
> be changed.
> If anyone can confirm, I'll create a bug report.
Right, it's not guaranteed. It's just that the chance of collision is
Thiago Macieira - thiago.macieira (AT) intel.com
Software Architect - Intel Open Source Technology Center
More information about the Development