15

Duplicate: Validate iPhone device Ids?

Does anyone know what constitutes a valid iPhone UDID?

Context: I am working on some session code for a server that interacts with iPhones, and was going to use the iPhone's UDID as a unique identifier. However, I can't seem to find any resources on the range of valid UDIDs, and I want to know exactly what I can expect coming from an iPhone.

Clarification: I'm not asking about how to validate an iPhone UDID as a legitimate iPhone UDID, I'm trying to figure out the range of UDIDs. For example, in programming languages there are specs on what you can use to name your variables (starts with a letter, contains letters and numbers, etc.). I want the same sort of spec for the UDID.

Community
  • 1
  • 1

5 Answers5

20

It is a 40 character hex string. There is no spec or doc out there that specifies the layout to this string.

I'm not really sure how you can determine what is 'valid' since only Apple knows which UDID are real and which are false.

My best guess, given the various UDIDs that I've seen, they are 40 characters in length, consisting of alphanumeric characters. (a-f0-9)

Nick Presta
  • 28,134
  • 6
  • 57
  • 76
  • 1
    Wait... if it's a 40 character *hex* string, wouldn't that make the values be A-F0-9? –  May 04 '09 at 02:15
  • 1
    The new phones (for 2018) seem to have a newer format for UDID: 25 characters (8 hex, dash, 16 hex). – rein Sep 27 '18 at 19:29
4

Actually, the iphone simulator udid has dashes and is 36 hex characters long.

For example:

002ebf12-a125-5ddf-a739-67c3c5d20177

Though I have only seen actual iphone udid's with hex only chars and 40 long.

thesmart
  • 2,993
  • 2
  • 31
  • 34
2

Most are 40 character HEX strings; we have 1 in our company that is 41 characters and is authorized in the dev center for Beta apps. Only way to add it was via safari however so worth noting if anyone gets the same.

TeckyBecky
  • 21
  • 1
  • 2
    How did you add the 1 with 41 characters? I have an UDID of an iPad with 41 characters and dev center says it is invalid or cuts it to 40, which makes it impossible to add. Thanks – gorkem Mar 23 '16 at 22:09
2

No, there is no way to do so. This question asks the same thing: Validate iPhone device Ids?

UPDATE: From what I've seen, the device ID is a 40 character hex string (0-9 and a-f). Apple's documentation for the deviceIdentifier property of UIDevice states:

A unique device identifier is a hash value composed from various hardware identifiers such as the device’s serial number. It is guaranteed to be unique for every device but cannot publically be tied to a user account. You can use it, for example, to store high scores for a game in a central server or to control access to registered products. The unique device identifier is sometimes referred to by its abbreviation UDID.

Community
  • 1
  • 1
Martin Gordon
  • 36,329
  • 7
  • 58
  • 54
  • Sorry, that's not quite what I'm asking, let me update my question. –  May 04 '09 at 02:07
1

try following regex ^([A-F0-9]{40})$

or you could go here and just paste it.

Hope this saves you some time.

Matas Vaitkevicius
  • 58,075
  • 31
  • 238
  • 265