Was looking into saving randomly generated items outside of my game in a .stash file that can’t be edited by the user (easily at least). I have worked with JSON and XML in the past, and understand that those two storage options are commonly used for Item/Data storage in games. Unfortunately, these are easily readable and accessible.
What are some options you have tried out? Are they worth it?
You could give binary files via the BinaryFormatter a try. That makes it much more difficult to read and change them. Be aware that there is no catch-all solution, which perfectly protects your data. There will always be people who figure out a way to reverse engineer it, if they want to. So instead, maybe just embrace the fact, that users can hack their own items. If there is no leaderboards etc, it shouldn’t be a problem.
On the other hand, if we are talking about sensitive information, global leaderboards etc, and you really want to make sure, that noone cheats, you will have to store this data on your own server. Basically, expect anything which is on the user’s machine, to be hackable. Obfuscation only makes it more difficult, but never prevents manipulation.
You can save the data to a json string, then encrypt the string, and write the encrypted string to disk. The resulting file will be unintelligible, but you will still be able to output human-readable data for debugging purposes.