Posted: May 2005Introduction
Kunzip is a free library under the LGPL license for decompressing ZIP archives. Kunzip started out as a test program I wrote for decompressing .zip files through a command line program. I eventually added hooks to make it a .so or DLL that can be used from Unix or Windows programs. My plan for the kunzip library was to make it as small (currently under 40k) and simple to use as possible so it can even be used from VisualBasic or such. It should be fully compatible with zipfiles created by InfoZip, PkZip, and WinZip. You can download it from the link below and view the prototypes for different languages that can call the kunzip library.
Related Projects @mikekohn.net
kunzip_test-2005-12-21.tar.gz (Small test program that calls functions in the libkunzip.so for Linux/Unix-like operating systems)
This package is licensed under the LGPL. You are free
to use this library in both commercial and non-commercial applications
as long as you dynamically link to it. If you statically link this library
you must also release your software under the LGPL. If you need more
flexibility in the license email me and we can work something out.
The November 14, 2006 version of kunzip changes the license to LGPL. Nothing more.
The April 25, 2006 version of kunzip fixes bugs in the kunzip_get_offset_by_name() function.
The January 20, 2006 version of kunzip fixes bugs in the kunzip_get_modtime() and kunzip_get_filesize() functions.
I guess for languages such as Russian, a file name in a zipfile is stored using a different encoding method. Right now on a Windows computer kunzip.dll does not handle this correctly. I'm working on fixing that.
The dates ignore daylight savings time. Therefore the uncompressed dates could be an hour off depending on your timezone. I think this is actually a common problem with ZIP unarchivers, but I could be wrong.
Some Boring History About Kunzip
I originally started this code to be able to decompress (and maybe
even compress) PNG graphic files. Since this is the same algorithm
used in gzip and zip (WinZip, InfoZip, etc), I decided to make it
work with .zip files instead. Unfortunately, all the specs I had
for this compression were for PNG and Zip is slightly different, so
I had some problems getting it working :).
DEFLATE compresses data by first running an
LZ77 compression scheme on a chunk of binary data and then taking
the LZ77 codes and compressing those with huffman. LZ77 compresses
data in the following way: If while writing a file, the compressor
sees that a combination of characters have already been written to the
file, the compressor will instead write out a distance code (the number
of bytes to search backwards in the uncompessed file) and a length code
of bytes to copy from that point in the file). So for example, if you
had a string of text that looks like this:
Copyright 1997-2017 - Michael Kohn