Search code examples
iphoneudid

Derive UDID from iPhone serial #


the docs state that the iOS UDID is a hash derived from serial # and something else. Does anyone know - what else, and what's the hash algorithm?

The reason is, we have an enterprise database of work-issued iPhones with serials in it, and the software uses UDID to identify a phone.


Solution

  • formula for udid described here: http://theiphonewiki.com/wiki/UDID

    EDIT: pasting the formula here:

    The UDID is being calculated like this:

    • Create a 60-character long or 59-character long (on newer devices) text string (see below)
    • Calculate the SHA1 hash of the text string. The result is the UDID.

    To create the text string, append the following four strings:

    • 11-character long or 12-character long (on newer devices) serial number (exactly like it is written in the Settings app)
    • one of these:
      • (on older devices) 15-character long IMEI number (without spaces); empty string for iPod touch and Wi-Fi model iPads
      • (on newer devices) 13-character long ECID in decimal, no leading zeroes
    • 17-character long Wi-Fi MAC address (letters in lower case, including colons); for the iPod touch first generation use "00:00:00:00:00:00"
    • 17-character long Bluetooth MAC address (letters in lower case, including colons)

    In short:

    On the Verizon iPhone 4 and newer:

    UDID = SHA1(serial + ECID + wifiMac + bluetoothMac)
    

    All else:

    UDID = SHA1(serial + IMEI + wifiMac + bluetoothMac)