From: Shawn Hargreaves Newsgroups: comp.os.msdos.djgpp Subject: Re: Allegro: Password protecting DATAFILE Date: Sun, 12 Oct 1997 23:36:15 +0100 Organization: None Distribution: world Message-ID: References: <61oa8h$9vg$2 AT news DOT interlog DOT com> <61ocqv$li3$3 AT news DOT ox DOT ac DOT uk> <34409173 DOT 3453 AT indy DOT net> NNTP-Posting-Host: talula.demon.co.uk MIME-Version: 1.0 Lines: 38 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Gautam N. Lad (gautam AT interlog DOT com) wrote: > This may be one of the dumbest question, but is there any way to > password protect Allegro's DATAFILE (.DAT) Not a dumb question, just an out of date one. Check my website for info on the latest Allegro developments: this is one of the new features in my work-in-progress version. George Foot added: > The encryption system is not particularly secure; anyone with the > source to your program could of course find out what the password is. Of course, but if you give someone the source for your program, it doesn't make much sense to protect your data from them! For someone who only has access to the program binary, I think it would be very difficult to crack the code. The encyption is very simple: each byte in the file is XORed with successive characters from the password, wrapping when it reaches the end of the string. Such methods can be broken by doing statistical analysis to work out the length of the password and deduce what the letters must be. This is particularly easy if you have some idea what the format of the original data should be (anyone with the source to Allegro can find out what the datafile format is...), but since the data is compressed before being encrypted, these patterns are greatly obscured and it isn't easy to work out what goes where. I think for a key of more than 15 or 20 characters, it would be practically unbreakable... Of course people could just single-step through your program and see what string it uses when it reads in the file, but there isn't a lot you can do about that. No matter how clever you are, a program can be cracked by anyone who tries hard enough: I think the best you can hope for is to make it difficult enough that nobody will bother... -- Shawn Hargreaves - shawn AT talula DOT demon DOT co DOT uk - http://www.talula.demon.co.uk/ Beauty is a French phonetic corruption of a short cloth neck ornament.