www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Support for zip decryption -- File attached

reply "Jarrett Billingsley" <kb3ctd2 yahoo.com> writes:
I wrote a ziplib for use with another language (Blitz3D).  I made sure to
add decryption support so that I could encrypt my game data files with
winrar and still be able to extract them in the game.  I noticed that
std.zip didn't have any decryption support, so I added it.

It doesn't have any support for encryption (adding files to the archive and
encrypting them), but that might come later.

The attached file contains myzip.d, which is exactly the same as std.zip,
except that the ZipArchive.expand() function no longer throws an exception
if it finds an encrypted file, and it has an extra optional parameter - a
char[] for the password.  So to decrypt a file, you'd do something like..

ubyte[] data=zip.expand(zip.directory["test.txt"],"qwe");

Where "qwe" is the password.  Note that because of the way zip encryption
works, there is not necessarily a "right" or "wrong" password - use the
wrong password, and it'll decrypt the file into nonsensical garbage.

There is another file in the attached zip called message.txt.  Try
extracting it using the new expand() function with the password "walter".
Dec 31 2004
parent reply "Simon Buchan" <not a.valid.address.com> writes:
On Fri, 31 Dec 2004 13:01:29 -0500, Jarrett Billingsley <kb3ctd2 yahoo.com>
wrote:

 I wrote a ziplib for use with another language (Blitz3D).  I made sure to
 add decryption support so that I could encrypt my game data files with
 winrar and still be able to extract them in the game.  I noticed that

Heh... I hope your game isn't OSS :D
Jan 03 2005
parent reply "Jarrett Billingsley" <kb3ctd2 yahoo.com> writes:
 Heh... I hope your game isn't OSS :D

Not to sound condescending, but opensource isn't really big in the Blitz3D community. In fact it's quite the opposite - just about everything has a price. Usually a small price, but a price nonetheless. Can't say as I'm too happy about it, but that's just because most of the people who use B3D were raised on shareware. I suppose I could break the mold and release my game as opensource, but then that'd defeat the purpose of my beautiful zip decryption ;) I didn't expect this addition to phobos to be that big, so I'm not that surprised that no one else has replied. Just curious, do you have any use for this?
Jan 03 2005
parent "Simon Buchan" <not a.valid.address.com> writes:
On Mon, 3 Jan 2005 17:26:27 -0500, Jarrett Billingsley <kb3ctd2 yahoo.com>
wrote:

 Heh... I hope your game isn't OSS :D

Not to sound condescending, but opensource isn't really big in the Blitz3D community. In fact it's quite the opposite - just about everything has a price. Usually a small price, but a price nonetheless. Can't say as I'm too happy about it, but that's just because most of the people who use B3D were raised on shareware.

Hmmm.....
 I suppose I could break the mold and release my game as opensource, but then
 that'd defeat the purpose of my beautiful zip decryption ;)

:D
 I didn't expect this addition to phobos to be that big, so I'm not that
 surprised that no one else has replied.  Just curious, do you have any use
 for this?

Probably not, but for a completionist point of veiw (or for a proof-of-concept extraction program or something) it's not as if it's pointless. In a predominantly OSS comunity like this (as most programming communities are) it is kind of pointless though, which may be part of the reason why it wasn't included in the first place. -- "Yes, the american troops have advanced further. This will only make it easier for us to defeat them" - Iraqi Information Minister Muhammed Saeed al-Sahaf
Jan 03 2005