- Home /
Is there something like deviceUniqueIdentifier that doesn't change?
I'd like to encrypt my PlayerPrefs
entries in order to stop the values I'm storing from being visible in plain text to script-kiddie level hackers[1].
I could just store the key to a symmetrical encyption system as a constant value within my app, but I'd also like to use some value that is unique to each device (like MAC address) to generate my encryption key, in order to stop people passing save games round from person to person.
Up until a few months ago, I'd happily use SystemInfo.deviceUniqueIdentifier
without a second thought. However, it would be a catasrophe if this value changed for a particular device, as happened recently with updates to iOS7. The device would no longer be able to decrypt the bona fide save games for genuine users.
Using SystemInfo.DeviceMode
, DeviceName
and DeviceType
would be good enough for my needs (they're not unique, but it would fragment the audience sufficiently), so long as those values will never change for the lifetime of any one device.
My question is: Is there another value that is guaranteed to be consistent for the lifetime of a physical device, to which I have easy access within Unity?
This is mainly for Apple devices, but bonus points for anything generic.
Peter Pimley
[1] Yes, I do realise that theoretically, with the app and the data on the user's device, any such effort is a matter of diminishing returns in terms of security. But I'd like to implement something better-than-nothing, which is where I currently am.
Answer by Dapperapps · Jul 19, 2014 at 08:40 PM
I think you would probably be better off writing a plugin for each platform you will support that talks to your unity game and relays this unique ID. Along these lines, specific to the iPhone I would use the phone's MAC Address, which should be unique per device unless overwritten. Good luck!