From: "Ben Davis" Newsgroups: comp.os.msdos.djgpp Subject: Re: Some dodgy FILE hackery Date: Thu, 16 Mar 2000 18:03:08 -0000 Organization: Customer of Planet Online Lines: 46 Message-ID: <8arkma$m3h$2@newsg2.svr.pol.co.uk> References: <8amfqu$ue5$1 AT newsg2 DOT svr DOT pol DOT co DOT uk> NNTP-Posting-Host: modem-15.deagol.dialup.pol.co.uk X-Trace: newsg2.svr.pol.co.uk 953243146 22641 62.136.152.143 (16 Mar 2000 21:45:46 GMT) NNTP-Posting-Date: 16 Mar 2000 21:45:46 GMT X-Complaints-To: abuse AT theplanet DOT net X-Newsreader: Microsoft Outlook Express 4.72.3110.5 X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Damian Yerrick wrote in message ... >On Tue, 14 Mar 2000 22:48:21 -0000, "Ben Davis" > wrote: > >>I use DJGPP and Allegro. Most of my files (eg. levels) are saved >>using the packfile functions of Allegro. I need to encrypt some >>of these files without making them bigger. > >Why? Do I detect a note of resent for the secretive? >>I have to do the encryption manually; the built-in password function >>isn't secure enough. > >I know; it's xor. And it contains an error in that most of the data are not encrypted! Obviously fixing it would mess up all the encrypted data everywhere that had already been saved by Allegro. Of course I could correct it myself, but XOR encryption is "subject to analysis" (as was discussed once on the Allegro mailing list). >>I want to intercept all the low-level file inputs/outputs (where DOS >>takes over from Allegro) so that I can modify the bytes at this stage. >>But I don't want to modify the Allegro source. > >Why not? Allegro for DJGPP is static linked. But the source isn't. I consider Allegro to be a general-purpose library for use in all programs. I'm not going to tailor it to any one program. >>The packfile functions of Allegro ultimately use read() and write(), and the >>DOS file handle is stored in the PACKFILE structure so I can access it >>readily. > >The Allegro source code is stored in /.../allegro/src so you can >access it readily. Yes, but I don't have to modify the PACKFILE structure; just read it. There's no point in writing when I know how to read :-) Ben Davis