Zip-file that contains nothing but itself?

2020-05-18 06:50发布

问题:

Just out of curiosity, does there exist a valid zip-file (according to format spec) that, contains nothing but itself?

Put another way, does the function implemented by unzip have a fix-point?

Can I write a program to search for such a fix-point in a intelligent (not-exhaustive) way?

I've thought about the opposite as well, i.e. if zip has a fix-point, but presumably a file can be compressed in different ways (different algorithms, different levels of compression and so on), thus whether or not f = zip(f) holds for some file f is probably implementation dependent. Since the zip-compression is loss-less however, the case for unzip should probably have a "formal" answer.

Has anyone explored this? Any pointers to related URLs are appreciated.

回答1:

You can read about it here: http://research.swtch.com/2010/03/zip-files-all-way-down.html

Here you will find r.zip, which contains itself.