解压任意数据?

Decompress arbitrary data?

(不包括一些 headers),通常是否可以解压缩(例如解压缩)任意数据,例如来自。 /dev/random?

换句话说,压缩数据是否表现出一些明显的模式以区别于随机数据?


关于 headers 的注意事项:如果您尝试像这样解压缩随机数据:

head -c 100 /dev/random > file
unzip file

您遇到错误

Archive: file End-of-central-directory signature not found. Either this file is not a zipfile, or it constitutes one disk of a multi-part archive. In the latter case the central directory and zipfile comment will be found on the last disk(s) of this archive. unzip: cannot find zipfile directory in one of file or file.zip, and cannot find file.ZIP, period.

是的,有很多特定的格式方面必须正确,以免解压器中止。

首先,header 格式的 unzip、gzip、zlib 等都在前几个字节中有神奇的数字,正是为了这个目的,以避免浪费时间在一个文件上首先不要使用 zip、gzip、zlib 等方式制作。

即使您获得了所有正确的 header 数据,压缩数据本身也几乎总是具有必须满足的格式限制。我所做的测试表明,以放气压缩数据形式呈现的随机数据平均在大约 100 个字节内被捕获。