Zip文件格式解析 6.3.3版本

目前Zip普遍是采用2012年6.3.3版本,目前没有比较新的文章分析6.3.3版的数据格式,查看代码实现解析过程

文件:APPNOTE.TXT - .ZIP文件格式规范
版本:6.3.3
状态:最终版本-替换版本6.3.2
修订日期:2012年9月1日
版权所有(c)1989-2012 PKWARE Inc.,保留所有权利。

 Version       Change Description                        Date
   -------       ------------------                       ----------
   ...           ...									  ...

   6.3.1         -Corrected standard hash values for      04/11/2007
                  SHA-256/384/512

   6.3.2         -Added compression method 97             09/28/2007

                 -Documented InfoZIP "Extra Field"
                  values for UTF-8 file name and
                  file comment storage

   6.3.3         -Formatting changes to support           09/01/2012
                  easier referencing of this APPNOTE
                  from other documents and standards     
   				  //翻译:为了支持其他文件和标准更容易引用而 ·更改格式·

数据格式如图所示
Zip文件格式解析 6.3.3版本

文件总体格式,参考图片中第一、第二行

      [local file header 1]
      [encryption header 1]
      [file data 1]
      [data descriptor 1]
      . 
      .
      .
      [local file header n]
      [encryption header n]
      [file data n]
      [data descriptor n]
      [archive decryption header] 
      [archive extra data record] 
      [central directory header 1]
      .
      .
      .
      [central directory header n]
      [zip64 end of central directory record]
      [zip64 end of central directory locator] 
      [end of central directory record]

实现解析Zip
解析中用了central directory header,故只参考了这部分的格式,如上图中第三、四行,原文

4.3.12  Central directory structure:

      [central directory header 1]
      .
      .
      . 
      [central directory header n]
      [digital signature] 

      File header:

        central file header signature   4 bytes  (0x02014b50)
        version made by                 2 bytes
        version needed to extract       2 bytes
        general purpose bit flag        2 bytes
        compression method              2 bytes
        last mod file time              2 bytes
        last mod file date              2 bytes
        crc-32                          4 bytes
        compressed size                 4 bytes
        uncompressed size               4 bytes
        file name length                2 bytes
        extra field length              2 bytes
        file comment length             2 bytes
        disk number start               2 bytes
        internal file attributes        2 bytes
        external file attributes        4 bytes
        relative offset of local header 4 bytes

        file name (variable size)
        extra field (variable size)
        file comment (variable size)

6.3.3版原文:Zip 6.3.3 官方说明文档
附录6.2.0版:Zip 6.2.0 官方说明文档(可以对照着看)

查看其他标准信息:ISO/IEC 21320-1 Information technology – Document Container File

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值