2023年12月20日发(作者:)

zip压缩包文件格式

原始文件

zip档案由PKZIP /解压缩软件组合产生的

PKWare公司创建。PKZIP项目与LHArc和ARJ

最好的压缩。

目录信息存储端的在存档文件中,每一个地方

档案从头;这头可以用

确定一个zip文件如:

偏移计数类型描述

0000h字符的ID = 4 'pk,03,04

0004h 1字版本需要提取档案

0006h 1字通用的位场(位图)

0文件是加密的

1 8k / 4K滑动字典用

2 - 3 / 2 Shannon-Fano树用

3-4闲置-内部使用5-15

邮编2定义如果

压缩方法是比其他

注:和1位

6型(爆)。

0008h 1字的压缩方法(见表0010)1个

000ah原DOS文件的日期/时间(见表0009)

000eh 1个32位?)

0012h 1 dword Compressed file size

0016h 1 dword Uncompressed file size

001Ah 1 word Length of filename

="LEN"

001Ch 1 word Length of extra field

="XLN"

001Eh "LEN" char path/filename

001Eh "XLN" char extra field

+"LEN"

After all the files, there comes the central directory structure.

(Table 0010)

PkZip compression types

0 - Stored / No compression

1 - Shrunk / LZW, 8K buffer, 9-13 bits with partial clearing

2 - Reduced-1 / Probalistic compression, lower 7 bits

3 - Reduced-2 / Probalistic compression, lower 6 bits

4 - Reduced-3 / Probalistic compression, lower 5 bits

5 - Reduced-4 / Probalistic compression, lower 4 bits

6 - Imploded / 2/3 Shanno-Fano trees, 4K/8K sliding dictionary

--- Central directory structure

The CDS is at the end of the archive and contains additional information

about the files stored within the archive.

OFFSET Count TYPE Description

0000h 4个字符的ID = 'pk,01、02

0004h 1字节版本的

0005h 1字节的主机操作系统了(见表0011)

0006h 1字节的最低版本需要提取

0007h 1字节的目标操作系统

上面看到的“主机操作系统”

0008h 1字通用的位标志

上面看到的“通用的位标志“

000ah 1字的压缩方法

上面看到的“压缩法”1个

000ch DOS日期/时间的文件

0010h 1个32位CRC文件(见表0009)

0014h 1个压缩文件的大小为1个

0018h压缩文件的大小

001ch 1字的长文件名

=“Len“

001eh 1字长度的额外字段

=“小龙女”

0020h 1字长度的文件

=“CMT”1字

0022h磁盘?

0024h 1 word Internal file attributes (bit mapped)

unused

0026h 1 dword External file attributes (OS dependent)

002Ah 1 dword Relative offset of local header from the

start o

0 - file is apparently an ASCII/binary file

1-15 -

f the first disk this file appears on

002Eh "LEN" char Filename / path; should not contain a drive

or device letter, all slashes should be forward

'/'.

002Eh+ "XLN" char Extra field

+"LEN"

002Eh "CMT" char File comment

+"LEN"

slashes

+"XLN"

(Table 0011)

PkZip Host OS table

0 - MS-DOS and OS/2 (FAT)

1 - Amiga

2 - VMS

3 - *nix

4 - VM/CMS

5 - Atari ST

6 - OS/2 1.2 extended file sys

7 - Macintosh

8-255 - unused

--- End of central directory structure

The End of Central Directory Structure header has following format :

OFFSET Count TYPE Description

0000h 4 char ID='PK',05,06

0004h 1 word 一些磁盘

0006h 1字数量的磁盘启动中央目录

0008h 1字的总数量的文件/路径条目这个磁盘上的

000ah 1字的条目总数在1个中央目录

000ch大小1个中央目录

0010h抵消启动中央目录相对

启动盘数

0014h 1字存档评论长度

=“白血病”

0016h“CML”字符zip文件的评论

延伸:拉链

事件:PC,Amiga,ST

程序:PkZIP,WinZip

参考: