Posted: May 2005
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. It can downloaded from the link below and view the prototypes for different languages that can call the kunzip library.
I've also been recently working a small .gz compression library that uses little memory and can speed up creating .gz files in situations where the redundancies are known at file creation time:
There is also a utility in this repository called parse_gz which can take a .gz file and print out all the huffman tables (if it's dynamic huffman) along with showing all the length / distance codes in the file. Useful for debugging deflate compression.
Related Projects @mikekohn.net
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.
This project was written to be compiled on Unix (Linux,FreeBSD,etc) systems. To build a DLL for Windows, download the source code and type: make dll. The mingw C compiler will need to be installed. I'm 99% sure I did some things that don't work in Visual C++.How DEFLATE works
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-2021 - Michael Kohn