如何确定ZIP/RAR文件的压缩方法

Int*_*nex 18 compression algorithm zip rar

我有一些我正在使用的zip和rar文件,我正在尝试分析每个文件的压缩属性(压缩级别,压缩算法(例如deflate,LZMA,BZip2),字典大小,字大小)等等),我还没有找到办法做到这一点.

有没有办法分析文件来确定这些属性,软件或其他?

干杯谢谢!

ata*_*tko 10

这是一个相当古老的问题,但我想要投入我的两分钱,因为上面的一些方法对我来说并不容易.

您也可以使用7-Zip确定这一点.打开存档后,有一列压缩方法:

7zip属性


pal*_*wim 7

通过 7-Zip(或 p7zip)命令行:

7z l -slt archive.file
Run Code Online (Sandbox Code Playgroud)

如果专门寻找压缩方法:

7z l -slt archive.file | grep -e '^---' -e '^Path =' -e '^Method ='
Run Code Online (Sandbox Code Playgroud)


Gfy*_*Gfy 6

我建议hach​​oir-wx查看这些文件。如何安装 Python 包,或者在使用 Windows 时可以尝试使用 PyPM 来使用ActivePython。安装必要的 hach​​oir 软件包后,您可以执行以下操作来运行 GUI:

python C:\Python27\Scripts\hachoir-wx

它使您能够浏览 RAR 和 ZIP 文件的数据字段。请参阅此屏幕截图的示例。

对于 RAR 文件,请查看WinRAR 安装目录中的technote.txt文件。这提供了 RAR 规范的详细信息。您可能会对这些感兴趣:

 HEAD_FLAGS      Bit flags: 2 bytes
                 0x10 - information from previous files is used (solid flag)
                 bits 7 6 5 (for RAR 2.0 and later)
                      0 0 0    - dictionary size   64 KB
                      0 0 1    - dictionary size  128 KB
                      0 1 0    - dictionary size  256 KB
                      0 1 1    - dictionary size  512 KB
                      1 0 0    - dictionary size 1024 KB
                      1 0 1    - dictionary size 2048 KB
                      1 1 0    - dictionary size 4096 KB
                      1 1 1    - file is directory
Run Code Online (Sandbox Code Playgroud)

字典大小也可以在 WinRAR GUI 中找到。

 METHOD          Packing method 1 byte
                 0x30 - storing
                 0x31 - fastest compression
                 0x32 - fast compression
                 0x33 - normal compression
                 0x34 - good compression
                 0x35 - best compression
Run Code Online (Sandbox Code Playgroud)

维基百科也知道这一点:

RAR 压缩实用程序是专有的,具有封闭的算法。RAR 的所有者是尤金·罗沙尔 (Eugene Roshal) 的哥哥亚历山大·L·罗沙尔 (Alexander L. Roshal)。RAR 版本 3 基于 Lempel-Ziv (LZSS) 和部分匹配预测 (PPM) 压缩,特别是 Dmitry Shkarin 的 PPMII 的 PPMd 实现。

对于 ZIP 文件,我首先会查看规范ZIP 维基百科页面。这些可能很有趣:

  general purpose bit flag: (2 bytes)
  compression method: (2 bytes)
Run Code Online (Sandbox Code Playgroud)


小智 6

对于ZIP - 是的,zipinfo

对于RAR,可以使用7Zip或WinRAR轻松找到标题,请阅读附带的文档