MODULE: EncryptedFile 1.1 - Updated 31 July 2007

Started by monkey0506, Tue 31/07/2007 07:39:52

Previous topic - Next topic

monkey0506

Seeing as HoN hasn't logged on in over 4 months, I figure it's probably safe to adopt his module. I've fixed some bugs that I encountered with HoN's module directly linked to the reliability of the data encryption (i.e., the ability to successfully decrypt it, not the strength of the encryption).

There are no longer any Raw functions; all data is encrypted so that if the file is read back a char at a time it can be successfully decrypted. Raw functions would break this functionality.

I've also added functions for encrypting/decrypting a single file (at a time) in the background. This way you can, for example, encrypt your data prior to distribution then decrypt it while the user plays the game. The default rate for encryption/decryption in the background is 1024 bytes per game loop (which my tests show result in no hit to game speed). This translates to 1 KB per game loop or ~40 KB per second. Any rate higher than this will result in DRAMATIC drop in game speed, although you can specify a lower value if you wish.

This module should be compatible with AGS 2.72 and 2.8 Beta 1+. I haven't tested it on any other versions, though it may be compatible with other versions 2.71 (it uses the new-style Strings; it will not be compatible with 2.7; also it only may be compatible with 2.71). Note that when importing it into 2.72 I received a warning that the module may be corrupt, however it compiled and ran perfectly. This may be an issue with exporting the module from AGS 2.8...?

Other than that...you can read the manual online here which includes the new function/property list as well as a description of how to use them. Feel free to ask if you have any questions.

And finally, you can download the module here.

You can also download the sample game I've written for testing encryption/decryption of a video here (Requires AGS 2.8 Beta 5+).

scotch

Seems useful for save game data, but for the people that want it for hiding video is there no more efficient way of reversibly corrupting video? When it comes to data like that just screwing up a few headers should do nicely.

(BTW, your download php serves things as text/html. Made my browser confused.)

TheMagician

Hi Scotch,

let me just point out that a workaround of "hiding" videos is just to rename their file extension to whatever you like. Then in the game do "PlayMovie()" and type in the new filename (including the "incorrect" extension).
AGS should now load the video normally but the user can't immediately recognize it as a video in your folder structure.

Of course the user could always rename the files and watch them normally, so unfortunately no "encryption" is involved.

scotch

#3
Well yeah, most people do it the renaming way, but those files will still play in video players even without renaming (at least some video players). I personally wouldn't go any further than that, but for those people that would make use of this module for corrupting purposes it could probably be done in a many times more efficient manner, AGS file functions allowing.

I only suggested it because 40kB/s decoding means that even a short cutscene could take an hour to decode.

Monsieur OUXX

One of the reasons mentioned to justify the existence of this module was also hiding some data concerning the player (nb of lives, etc.), so that he cannot cheat by editing the save file.
 

scotch

Yeah, and it seems very handy for that purpose, as I said. I don't know if anyone actually planned to use it for video or not. Ignore me if they didn't.

monkey0506

#6
I didn't necessarily mean to say this module was only useful for video encryption/decryption. But it had been asked before if it could be done, and in my tests even if you used the module to encrypt and decrypt it the new file would be corrupted. This was due to some minor bugs with previous versions. This is part of why I've removed all raw access.

Now clearly it's better put to use for smaller files, but some members may find it useful if they have a small video they wish to encrypt.

Based on your comments scotch I thought perhaps I could just screw up a few file headers, but there's no way to just modify existing data in a file. You would have to read out all the data in the file and save it to a new file anyway.

Hehe...sending the proper headers fixed the problem with your browser thinking it was text/html. It should load properly now.

scotch

Ah, ok, I wasn't aware that modifying files in place was impossible. Didn't mean to imply I didn't see the module's obvious uses.

monkey0506

Yes if there was some way we could pre-pend text anything to a file it would be a simple matter, but it's impossible to do that directly or to directly modify a file's contents. In order to modify a file in any way while keeping the rest in-tact you would still have to copy the entire thing to a new file. :-\

sgreco

sorry monkey , but i can't see download your module..
please can you upload again ?

Dualnames

Quote from: sgreco on Fri 18/06/2010 16:37:17
sorry monkey , but i can't see download your module..
please can you upload again ?

Here it is for your leisure.

http://www.mediafire.com/file/uzeddydmzmx/EncryptedFile_1_1.rar

Including the testing demo Monkey included at the first place. The band is emo btw. :D
Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

Crimson Wizard

Can the current module "maintainer" (monkey, or whoever he/she is) add EncryptedFile_VERSION macro defintion to it?

I am writing my own HiScores module now (I didn't like Rocco's one for certain reasons, which I may explain later), and I am thinking about publishing it here as well when it's ready; it has an optional EncryptedFile support, which requires checking some macro to determine if EncryptedFile module is present.

SMF spam blocked by CleanTalk