Zip Size

Nov 12, 2008 at 9:38 AM
I've been doing some testing to protect against a 'zip bomb' (where someone compresses a very large file to a very small file, e.g., a file containing 1 billion 0's compresses down to something very small). Anyway, using the Best-zip option in WinRAR, such a file compresses down to 948KB while DotNet Zip compresses the same file down to 8.24MB (almost 10x the size). Now, certainly 8.24MB is a lot smaller than 953MB (original file's size) but is there some reason that DotNet Zip does not compress such a file tighter than it does?


Coordinator
Nov 12, 2008 at 1:49 PM
DotNetZip uses the DeflateStream class in the System.IO.Compression namespace for the compression algorithm.  The zipfile size and the compression ratio is a result of the implementation of the DeflateStream class.  It's known to not have all the optimizations it could have. 
Nov 13, 2008 at 5:52 AM
That is understandable. However, think of all the fun you could have implementing a more optimized version, keeping your interfaces, of course. :-)