zlib is a patent-free open-source implementation of gzip for short. zlib provides a simple API for using gzip compression in your programs. The use of a shared library makes it simple to replace buggy implementations while reducing memory usage.

Zlib is a compression format described in RFC 1950, and implemented in the popular programming library by the same name, written by Jean-Loup Gailly and Mark Adler. Zlib is actually just a container; in theory it can support any type of compression, and in fact very recent version of zlib support a basic run length encoding compression method. But generally speaking zlib is used with DEFLATE, the compression algorithm used in PKZip and gzip. However, the normal output of zlib cannot be decompressed by a program that handles Zip or Gzip files; the zlib format is specific to zlib itself. However, given an implementation of DEFLATE, it's quite simple to write code that handles the Zlib format, since it basically consists of putting a properly formatted set of magic numbers at the start.

Like gzip, zlib only handles a single stream of data at a time; while it would be possible to support single-file access like Zip does, this would have to be done at the application level. The zlib format is used in many protocols, including HTTP compression, PNG, and OpenPGP.

Zlib has suffered from a few security bugs in the recent past; due to zlib's very wide use, these affected a lot of applications, but fortunately the holes were never exploited to any wide extent. For a while it had seemed that development was mostly in a holding pattern, but with the recent release of the 1.2 version series, development seems to be moving along well, with a lot of bug fixes, optimizations, and new features being added.

The basic interface to zlib is written in C, but bindings for C++, Python, Perl, and nearly every other language you can think of are supported. In addition, a few people have reimplemented Zlib compressors and decompressors from scratch in Java and C++. The zlib interface has also ended up being the canonical interface for a compression library; the programming interface to bzip2, zlib's only major competitor, is nearly identical.

Zlib is available for pretty much every platform in existence, including Unix, DOS/Windows, Mac Classic, BeOS, OS/2, VMS, OS/400, and OS/390. It is used in programs ranging from Firefox to XFree86.

Log in or register to write something here or to contact authors.