Encryption
Encryption
Is there a good free way to encrypt your files, or does irrlicht support any type of encryption?
-
- Competition winner
- Posts: 1123
- Joined: Sun Jun 10, 2007 11:14 pm
Encryption is extremely easy to program yourself.
Here's an example of XOR encryption. It's basic, but is what many of the more powerful encryption methods build upon: http://www.cprogramming.com/tutorial/xor.html
Here's an example of XOR encryption. It's basic, but is what many of the more powerful encryption methods build upon: http://www.cprogramming.com/tutorial/xor.html
-
- Posts: 1186
- Joined: Fri Dec 29, 2006 12:04 am
XOR encryption looks great, but possibly a little basic (which may be what I need for real time decryption, I'm not sure everyone has 3 gigs of ram yet...).
I think a library would be the way to go! That one looks great, but the only "documentation" is for a previous version and "the syntax has changed allot". Still I think a library would be great, and now I've got some names to go on and some code to try out.
Thanks!
I think a library would be the way to go! That one looks great, but the only "documentation" is for a previous version and "the syntax has changed allot". Still I think a library would be great, and now I've got some names to go on and some code to try out.
Thanks!
No encryption is secure at the client end, you need to store the private keys in the application where they can be read by anyone who bothers to dig them out.
Because of this problem, even the best encryption is really just obfuscation; a matter of hiding the keys. Mixing up the data in your own special way will probably be more secure than off the shelf encryption.
Because of this problem, even the best encryption is really just obfuscation; a matter of hiding the keys. Mixing up the data in your own special way will probably be more secure than off the shelf encryption.
-
- Posts: 1186
- Joined: Fri Dec 29, 2006 12:04 am
I use AES encryption for my network packets in realtime.P1SQ4M wrote:XOR encryption looks great, but possibly a little basic (which may be what I need for real time decryption, I'm not sure everyone has 3 gigs of ram yet...).
There's a nice example application in the SDK and the wiki has lots of information too.P1SQ4M wrote: That one looks great, but the only "documentation" is for a previous version and "the syntax has changed allot".
"Whoops..."
-
- Posts: 288
- Joined: Wed Oct 29, 2008 12:07 pm
We use simple XOR encryption, coupled with a PAK file to speed up file loading. Basically, PAK all of your files into a single file and use filemapping to seek through it. Use XOR to encrypt the PAK file. You might have to write some file loaders to make it work with Irrlicht. The hacker then has to guess the file format (not hard, I do it all the time) and decrypt it at the same time. It's a little harder when the entire PAK file is encrypted.
The XOR encryption doesn't have to be a single byte, you can use a really long character string and cycle through it to get your XOR keys using the modulo operator.
P.S. I have a lot of experience mapping out file formats. Not specifically for games, although I have done a couple of those too. It's harder to determine a file format that is already encrypted (although a single XOR byte key isn't hard). If the file table isn't encrypted, then it's harder too...
The XOR encryption doesn't have to be a single byte, you can use a really long character string and cycle through it to get your XOR keys using the modulo operator.
P.S. I have a lot of experience mapping out file formats. Not specifically for games, although I have done a couple of those too. It's harder to determine a file format that is already encrypted (although a single XOR byte key isn't hard). If the file table isn't encrypted, then it's harder too...
-James
Yeah, 'is'. Sorry.P1SQ4M wrote:Great advice, could the person run the brute force untill it comes up as a recognizeable file type, or does it just take more time? (good too )
do you mean is?If the file table isn't encrypted, then it's harder too...
Thanks
Yeah, when I run brute force, it's with a single BYTE XOR key looking for a JPEG or GIF89a header (or PNG, wav, ogg, etc...). With a rotating XOR key based around the modulo operator, it's a LOT harder unless I know the header format.
Sample source:
http://code.assembla.com/sexy/subversio ... erface.cpp
The header for that PAK format has 8 known characters, the Magic WORD and the Format version (stored as 2 DWORDs). If the rotating key were shorter than 8 characters, then I would immediately know the password. If it were longer, then I code a significant portion of the file looking for known headers.
But this isn't a discussion about strength. Really, what it comes down to is how hard to do want to make the encryption and how much time you want to spend on it. My philosophy is that if someone really wants to get at your data, they will. Just set the bar high enough so that it really takes someone a great deal of time and/or effort.
Time is like money. If there is too much time/effort needed to crack the format then a lot of people will move on to something more fruitful.
The time argument also applies to the creation of the encryption. Here you will run into the law of diminishing returns. For instance, a PAK file is a great idea, but if you are fixing to ship your product and have no clue about file mapping (see sample source) then it may not be a great return or your time invested (more headaches).
-James
I think Windows has CryptoAPI that can do exactly what you need.
Check Both Links:
http://www.codeproject.com/KB/security/ ... toAPI.aspx
http://www.codeguru.com/cpp/misc/misc/cryptoapi/
There you should find everything you need to do what you want.
Check Both Links:
http://www.codeproject.com/KB/security/ ... toAPI.aspx
http://www.codeguru.com/cpp/misc/misc/cryptoapi/
There you should find everything you need to do what you want.