Re: Any zip or tgz that decompress to itself ?



Olivier Girant wrote:

I do not intend to add data to "compress better"... I imagine the zip archive content like this:
- header for compressed file1
- compressed file1
- central directory for file1
- digital signature

The header and the central directory are very redundant, you can see some run of 0 and several fields are the same. Moreover you can play with archive comment to add even more redundancy, so as to make the global archive size equal to the uncompressed file size.

Consider both directions: while you are free to add an arbitrary comment while zipping file1 into file2, the same comment must reappear when unzipping file2 (it will, of course), and since file1 has to equal file2, the comment also must reappear when unzipping file1! Right?

But unfortunately an comment does not affect compression, it's only stored in the archive, making it longer. Now you want that longer archive compress again to the same size as before, without the comment. Consequently the payload, the compressed file1, must become shorter by exactly the length of the added comment. That's why I said that you want better compression.

DoDi
.