Skip to main content
gamedev.net
🔒 Locked

Encryption Algorithms

Started by Rebooted Jan 27, 2004 at 11:39 AM 3 replies 800+ views
Original Post
Rebooted
Rebooted
I''m looking for an encryption algorithm for my game''s file format. I KNOW I can''t stop hackers completely, but I need some form of encryption. Any opinions on the best algorithms or links to articles/example code/libraries?
SiCrane
SiCrane
thefreecountry.com has a list of free encryption libraries.

What encryption to use depends on how secure you want to be versus how many cycles you want to waste.
superdeveloper
superdeveloper
1) Try using a pseudo-random function (a seed that you remember) function that generates, say, 1024 random bytes.

Do this above step (#1) just once, at the beginning of your program...


2) use XOR to cycle through this 1024 window of bytes againts the data, obfuscating it.

3) save this new data as your game data.

4) in your game, run the exact same function (#2), XORing again, to unobfuscate it. (remember that in your game, you must do step #1 when it begins)..

Sure it''s not 100% safe, but would require annoying amount of work to decompile the program to see your random function and how you generate your key window.. Or perhaps the cracker can just copy the 1024 bytes and run their own XOR.. Either way it would involve some work for them
Polydone
Polydone
Yep, your only option is obfuscation, since your program must have both the ciphertext and the key to get the data. (And also the algorithm).

***
For Java games and Java related resources, go to http://www.javaengines.dk
***
Tjoppen
Tjoppen
CipherSaber does pretty much what superdeveloper describes. It takes keys up to 256 bytes in length, and uses them to seed a RNG. It also adds ten random bytes to the end of the key which are stored before the data for reasons described on the website(if you feel like going ultra-simple you could probably drop it).

It's a very simple algorithm. Can be implented in around ten minutes(although if you miss the stuff about the ten random bytes like I did it takes a bit more time).

The key for deciphering could be pretty much anything. One interesting thing would be to simply use the filename and obfuscate a little as to how the key is actually derived from it;

char *gpFilename;
char **gpKeyPointer = (char**)~(int)&gpFilename

void DecipherFile( char *pFilename )
{
gpFilename = pFilename;
printf( "key: %s\n", *(char**)~(int)gpKeyPointer );
}


edit:
A little more obfuscation...

[edited by - Tjoppen on January 27, 2004 4:49:55 PM]
delete this;

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.