The Crypto++ library is a freeware
library of cryptographic schemes, written by Wei Dai. However the library
also contains other useful classes which are not immediately apparent when you use the library. Two of these are
the Gzip and Gunzip classes which can be used to compress and decompress (zip and unzip) data.
Compressing your data could not be simpler. Say you had data pData that was of size dwLen that
you wished to compress.
byte* pCompressed = new byte[zipper.MaxRetrieveable()];
pCompressed now contains the compressed data.
You may not be surprised to know that decompression is just as easy. (dwLen is now the length of our
byte* pData = new byte[unzipper.MaxRetrieveable()];
pData now contains the uncompressed data.
Thanks to Wei Dai for his permission to write this article in what is hoped to be a series of articles on the
use of his Crypto++ library.
The latest versions of the Crypto++ library can be found here