So I've been working on an encryption algorithm to save my game files. My current approach is a double hash encryption: this is where you generate two keys and you get the hash values of both, then you multiply those together to get a master key and multiply that value by the bits of the data you want to encrypt to get the encrypted data.
My question is, what are some alternatives/ your favorite encryption algorithms to use for your save file data?
Encrypting Files
Moderator: PC Supremacists
- dandymcgee
- ES Beta Backer
- Posts: 4709
- Joined: Tue Apr 29, 2008 3:24 pm
- Current Project: https://github.com/dbechrd/RicoTech
- Favorite Gaming Platforms: NES, Sega Genesis, PS2, PC
- Programming Language of Choice: C
- Location: San Francisco
- Contact:
Re: Encrypting Files
I usually encrypt mine with ASCII. What can I say.. I like modders.
On a more serious note: If you're decrypting the data locally, it's not safe. If the encryption key is stored locally, it's a trivial matter to extract it and modify the game files manually. The only way to truly protect save data is to store it server-side (which obviously isn't an option for offline games). Because of this, I find it rather silly to even bother trying to protect it at all. Although, most modders do enjoy a good challenge now and again, so there's that.
On a more serious note: If you're decrypting the data locally, it's not safe. If the encryption key is stored locally, it's a trivial matter to extract it and modify the game files manually. The only way to truly protect save data is to store it server-side (which obviously isn't an option for offline games). Because of this, I find it rather silly to even bother trying to protect it at all. Although, most modders do enjoy a good challenge now and again, so there's that.
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches!
Re: Encrypting Files
I'm currently using Unity, so all the keys are generated within the engine and stored in Unity's data format internally upon build. I like the idea of having modding, but for a simple mobile game I think it would be tacky for the user to be able to change their high score, currency value, etc by simply opening up a text file and changing values that are plain to read. I would say that its not as much of an encryption algorithm as it is a data scrambler. I'm also using it for my 2D toolkit. Idk if Unity is frowned upon, but I find it meets my team's needs right now. It just doesn't have all the tools and resources I feel it should already have. Like C# has encryption and compression libraries built in, but Unity stripped them of it, that is why I decided to write my own.
On another note, do you know a good way to make a data table for the ASCII values. That was my original plan to write the save file format in, but ASCII references were replaced with Unicode; so I would have to make my own table/ lookup algorithm.
On another note, do you know a good way to make a data table for the ASCII values. That was my original plan to write the save file format in, but ASCII references were replaced with Unicode; so I would have to make my own table/ lookup algorithm.
- dandymcgee
- ES Beta Backer
- Posts: 4709
- Joined: Tue Apr 29, 2008 3:24 pm
- Current Project: https://github.com/dbechrd/RicoTech
- Favorite Gaming Platforms: NES, Sega Genesis, PS2, PC
- Programming Language of Choice: C
- Location: San Francisco
- Contact:
Re: Encrypting Files
Ah, mobile app. Completely different story there. I was thinking you were targeting PC users.jchill95 wrote:I'm currently using Unity, so all the keys are generated within the engine and stored in Unity's data format internally upon build. I like the idea of having modding, but for a simple mobile game I think it would be tacky for the user to be able to change their high score, currency value, etc by simply opening up a text file and changing values that are plain to read.
If the default is Unicode, I would be wary of using something else. There is probably a reason it's Unicode (usually related to foreign language compatibility). That said, if you're not storing any user-generated data (usernames, device names, passwords, etc.) and you're writing the save/load mechanisms from scratch, then you're free to encode the data however you wish. I would lean toward keeping it as simple as possible.jchill95 wrote:On another note, do you know a good way to make a data table for the ASCII values. That was my original plan to write the save file format in, but ASCII references were replaced with Unicode; so I would have to make my own table/ lookup algorithm.
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches!