MacOS – ITunes backups – how’s the UID generated

backupitunesmacosrestoreuuid

I'm struggling with an issue with an encrypted backup (see Apple Backup encrypted format specs? I need to decrypt part of a backup (for which I have the key) that iTunes won't restore and How to verify that an iTunes backup is valid? if you want the details) and I'm trying to understand how things got so messed up.

For that I'd need to understand how are the backup UIDs created. Are they "hardware" based? I don't think so as if expect to have a lot of "iPhone Backup" keys in Keychain as I've been "evolving" my devices over time…

So where do they come from?

EDIT: To make clearer what I mean, when I say UID I'm referring to the number that's in the folder where the backup is stored.

The location of the backups is on:

Mac: ~/Library/Application Support/MobileSync/Backup/{UID}

Windows Vista and Windows 7: \Users\(username)\AppData\Roaming\Apple Computer\MobileSync\Backup\{UID}

And the UID itself is a long string of hexadecimal characters like:

59cf77659e76a55e206192c325f732xxxxxxxxxx (last 10 digits removed in case it's some "magic" number)

Thanks a lot!

Best Answer

Given the length of the UID, I suspect the value is a cryptographic hash value. Hashes are often used to avoid collisions and can be recreated if the original input is known.

SHA1 is 40 characters when hex encoded.

We can rule out an OS X uuid and Window's GUID as the lengths are too short. Additionally values returned by uuid on the same hardware include identical segments – unlike a hash.