Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This question already has an answer here:

I want to make a game data archive that contains all the game assets, now I could use zlib or lz4 to just make a simple zip archive type thing, but I need a bit more security, does anyone have any recommendations on adding AES encryption to the whole thing? I was also thinking maybe I need like a MPQ archive type system where I can mount the thing in the game engine and it acts as an interface to accessing the individual files inside, allowing streaming?

Any ideas appreciated, thanks.

share|improve this question

marked as duplicate by bummzack, John McDonald, Anko, Maik Semder, bobobobo Apr 12 '13 at 18:18

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

I'm not really sure what you're asking. "What is the best way to do X?" questions do not really fit the Q/A format of the site. If you have a specific problem you need to solve then you might want to reword your question to reflect it and perhaps provide some context for what your application is. – Mokosha Apr 12 '13 at 17:33

A better approach than straight up encrypting the data would be to pack the data in a compressed format that still allows efficient loading, and then use a check sum to verify the integrity of the data at load time. Any form of message digest (even rolling your own) should be significant enough.

Also, be aware of what encryption seeks to accomplish, and who it keeps out. If your objective is to keep 100% of people from accessing your data, then you may want to reconsider not shipping that data with the game. The objective of this is to keep out the majority of people, but the people that really want access to this data will take the time to break your compression/encryption efforts, or simply access the data in memory when the program is handling it.

share|improve this answer
"If your objective is to keep 100% of people from accessing your data, then you may want to reconsider not shipping." FULL STOP. – bobobobo Apr 12 '13 at 18:18
I'm not sure I understand, is this incorrect? – Evan Apr 12 '13 at 18:58
What he's saying is 1st para) If you're worried about hacking the game/cheating, use a checksum to ensure game data wasn't fiddled with. 2nd para) If you're worried about people stealing your game assets/image files, they will probably find a way to do it regardless of your efforts to stop them. – bobobobo Apr 12 '13 at 19:00
True, these sound like they contradict each other out of context, but the point was to express the fact that you can never be 100% secure, so I was simply suggesting a more efficient method to provide some form of security against asset tampering, that will keep out the 99%, but not waste any unnecessary effort to protect against that 1%. – Evan Apr 12 '13 at 19:03
I personally don't understand these efforts to "keep people out". Your game assets are protected under copyright law. If someone infringes, sue them. – bobobobo Apr 12 '13 at 19:06

This is utterly pointless. You need to protect your game assets so bad that you want to hit load times with it? Just use "security by obscurity" and pack the data into a single binary (.wad or .mpq style)

share|improve this answer
Yeah but how? Is there any library? – user1040769 Apr 12 '13 at 18:32
FILE and fseek() is all you need. – bobobobo Apr 12 '13 at 18:35

Not the answer you're looking for? Browse other questions tagged or ask your own question.