Re: [iPhone] How to create a unique string
Re: [iPhone] How to create a unique string
- Subject: Re: [iPhone] How to create a unique string
- From: Eric Gorr <email@hidden>
- Date: Thu, 13 May 2010 11:58:33 -0400
On May 13, 2010, at 11:52 AM, Louis Gerbarg wrote:
> On May 13, 2010, at 11:05 AM, Michael Ash <email@hidden> wrote:
>
>> On Thu, May 13, 2010 at 10:56 AM, Thomas Davie <email@hidden> wrote:
>>>
>>> On 13 May 2010, at 15:33, Eric Gorr wrote:
>>>
>>>> So long as it is ok for the string to be unique for the network the user is on only. From the docs:
>>>>
>>>> The ID includes the host name, process ID, and a time stamp, which ensures that the ID is unique for the network.
>>>>
>>>> A UUID (Universally Unique Identifier) is entirely unique.
>>>
>>> No it's not, as can easily be proven by observing that there are only a finite number of 40 character strings. A UUID is probabilistically unique.
>>
>> CFUUID includes the MAC address, so unless your MAC address is cloned
>> or you manage to generate two UUIDs on the same device in the same
>> 100ns time interval or the calendar rolls over (which will take about
>> 3700 years), they are entirely unique within the universe of CFUUID
>> strings.
>
> No, it doesn't use the MAC address. MAC addresses are uses as part of type 1 uuids, CFUUID has generated type 4 (random) uuids by default since Tiger, and has always generated type 4 on iPhone. If you look at the source to CF there is a way to force it to generate type 1 uuids, but I doubt that is supported.
From the documentation:
http://bit.ly/9m1Ggb
UUIDs (Universally Unique Identifiers), also known as GUIDs (Globally Unique Identifiers) or IIDs (Interface Identifiers), are 128-bit values guaranteed to be unique. A UUID is made unique over both space and time by combining a value unique to the computer on which it was generated—usually the Ethernet hardware address—and a value representing the number of 100-nanosecond intervals since October 15, 1582 at 00:00:00.
So, regardless, a UUID (via the CFUUID API) is going to be better then [[NSProcessInfo processInfo] globallyUniqueString] _______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden