Page 1 of 1

Good zip library ?

Posted: Thu Jan 14, 2010 3:07 pm
by madmarx
Hello everyone,

Does someone know a good zip library allowing :
> compression into memory
> compression into a file
> compression of a directory tree (or a bunch of files) into 1 file
> decompression
> decompression into memory of a chosen file.
> decompression with password/key (decryption)
> working on windows
> without memory issue!
?

I have also 2 other needs that are less important :
> compression with encryption (using key/password)).
> multiplatform linux, mac ?

Right now, it seems the zlib is near what I am looking for, but I can't find informations on password / encryption of files.
If you have knowledge on these zip question, that may enlighten me, don't hesitate to share it :wink: .

If you know one library, please let me know, I'll patch Ogre::source with the corresponding Ogre::Archive, promise!

EDIT : after a little thinking it seems encrypting is ok, since each file is encrypted separately, and not as a whole. I just need to encrypt myself each files!

Re: Good zip library ?

Posted: Fri Jan 15, 2010 8:28 am
by stoneCold
The best compression you might get by using the compression algorithms that 7zip offers. There seems to be a project over at google code that exposes the 7zip API.
The LZMA algorithm delivers quite good results when it comes to compression/speed, so this one might fit best for your needs.

[edit]: the LZMA part of 7zip seems to be available under the public domain as well, so this might be worth checking out too.

Re: Good zip library ?

Posted: Fri Jan 15, 2010 8:41 am
by jacmoe
Ratcliff has a compression/decompression performance test going:
http://www.codesuppository.blogspot.com/

I am very interested in FastLZ myself. (http://www.fastlz.org/)
But, you can't have both speed and zero overhead and good compression at the same time.

Re: Good zip library ?

Posted: Fri Jan 15, 2010 3:32 pm
by mkultra333
I've notices 7-zip files (.7z) gives slightly better than zip compression when archiving a single project, but when putting a bunch of almost identical projects into a single .7z file the compression is awesome, much better than zip. It seems to recognize when two folders of stuff are virtually identical, where normal zip compression doesn't.

Decompression can be slow sometimes though when you've compressed multiple similar folders. About the same as zip for a single folder though.

Re: Good zip library ?

Posted: Fri Jan 15, 2010 4:10 pm
by syedhs
Yes agree that 7zip provides superior compression - nowadays, I use this to compress my file to send over email for an example. And the 7zip library is available for creator itself, at www.7-zip.org. The license is "public domain" - last time it was GPL, but commercial uses can have different license.

Re: Good zip library ?

Posted: Sat Jan 16, 2010 5:45 am
by mkultra333
Probably worth pointing out that the 7zip library covers zip compression as well.
Supported formats:

* Packing / unpacking: 7z, ZIP, GZIP, BZIP2 and TAR
* Unpacking only: ARJ, CAB, CHM, CPIO, DEB, DMG, HFS, ISO, LZH, LZMA, MSI, NSIS, RAR, RPM, UDF, WIM, XAR and Z.

Re: Good zip library ?

Posted: Sat Jan 16, 2010 10:37 am
by madmarx
I had already a glimpse at the lzma before, and the code seems to me like a real mess.
In the end I had to make 'search' in the directory structure to find the required cpp! Then, the doc is close to nothing.
For that reason, I was looking for some other package.
Fzip proposed by jacmoe is much more easy (2 functions only!). Unfortunately, it does not handle multiples files (and unzipping only one in a zip).
I am currently working on an elegant solution with database+ multiple fziped files + a listener to encrypt / decrypt data.