How can I get a Persistent Unique Hardware ID?

Hi,

I wan’t to get a Persistent Unique Hardware ID that I will use to encrypt (probably RC4) my game data that I save to disk.

In short I want to encrypt and device lock my save data (serialized) but I need this ID to be persistent (after say an update to their phone) so they don’t lose there save data.

Another reason I need this is if I have an in app purchase to remove ads, I want to then be able to save this to disk so I remember it in case the app is offline next time it runs, but I don’t want this saved file to be able to then just be copied to anyone and have it work to disable ads (for free).

Does anyone know a way I can get this ID / generate it?

Looking mainly for Android and iOS.

Cheers!

just an idea:

any reason not to use Unity - Scripting API: SystemInfo.deviceUniqueIdentifier ?

although for encrypting you could maybe combine such with your own string (e.g.: “thisappisgreat” or something), so you make it a little harder to decrypt that file.

Your point of encrypting in app purchases will not really protect from not paying for them. If you use Application.PersistentDataPath then non-root user won’t be able to access files. If a guy has root and doesn’t want to pay for in app purchases, then 90% chance he will use an app like freedom to trick your app into buying your ad free version. So encryption is not really an option, just a lot of work for you. To really prevent these things you have to have a server hosted which checks if he has paid. Anyways, if you are on Android and offline, you will not get ads, even if you get, dev won’t get a single penny for them