惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Attack and Defense Labs
Attack and Defense Labs
The GitHub Blog
The GitHub Blog
C
Check Point Blog
博客园_首页
MongoDB | Blog
MongoDB | Blog
N
Netflix TechBlog - Medium
F
Full Disclosure
Microsoft Security Blog
Microsoft Security Blog
爱范儿
爱范儿
Recent Announcements
Recent Announcements
阮一峰的网络日志
阮一峰的网络日志
G
GRAHAM CLULEY
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
T
Threat Research - Cisco Blogs
C
Cybersecurity and Infrastructure Security Agency CISA
V
Vulnerabilities – Threatpost
K
Kaspersky official blog
博客园 - 司徒正美
S
Schneier on Security
T
The Exploit Database - CXSecurity.com
Project Zero
Project Zero
云风的 BLOG
云风的 BLOG
Cisco Talos Blog
Cisco Talos Blog
Know Your Adversary
Know Your Adversary
雷峰网
雷峰网
V
V2EX - 技术
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Spread Privacy
Spread Privacy
罗磊的独立博客
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
S
Security Affairs
SecWiki News
SecWiki News
Schneier on Security
Schneier on Security
O
OpenAI News
Jina AI
Jina AI
PCI Perspectives
PCI Perspectives
Cyberwarzone
Cyberwarzone
Y
Y Combinator Blog
Apple Machine Learning Research
Apple Machine Learning Research
B
Blog RSS Feed
I
InfoQ
D
Docker
P
Palo Alto Networks Blog
Recorded Future
Recorded Future
M
MIT News - Artificial intelligence
博客园 - Franky
B
Blog
Scott Helme
Scott Helme
博客园 - 叶小钗
D
DataBreaches.Net

博客园 - 离线

Arduino语法详解_含示例详解 用C#实现的几种常用数据校验方法整理(CRC校验;LRC校验;BCC校验;累加和校验) C#设计模式 ---- 总结汇总(转载) 压缩包Zip格式详析(全网最详细) MQTT介绍 mDNS知识 学习笔记 彻底明白Zigbee术语——群集(Cluster)、端点(EndPoint)等 转载:IconFont(矢量图标字体)在Winform中的应用 C# 使用OLEDB 读不出 Excel 参数配置说明 Excel 12.0; HDR=Yes; IMEX=1;READONLY=1 ESA SNAP中超分模块处理Sentinel-2数据效果图 Windows 下安装 RabbitMQ服务异常 安装RabbitMQ时出现Plugin configuration unchanged,RabbitMQ服务启动几秒后自动关闭, http://127.0.0.1:15672/页面无法访问一并解答 windows10环境下的RabbitMQ安装步骤(图文) .NET Core 微服务架构学习与实践系列文章目录 .Net 微服务架构技术栈的那些事 Newtonsoft.Json高级用法 WPF:选择器(selector) MVVM处理TreeView的SelectedItem的绑定的两种方式
转(zip文件格式说明)
离线 · 2023-06-29 · via 博客园 - 离线

zip文件由三部分组成:压缩的文件内容源数据、压缩的目录源数据、目录结束标识结构

1、 压缩的文件内容源数据:

记录着压缩的所有文件的内容信息,其数据组织结构是对于每个文件都由file header 、file data、data descriptor三部分组成。

1)File header:用于标识该文件的开始,结构说明如下:

                               Header

Offset

Bytes

Description

0

4

Local file header signature = 0x04034b50 (read as a little-endian number)

文件头标识,值固定(0x04034b50)

4

2

Version needed to extract (minimum)

解压文件所需 pkware最低 版本 

6

2

General purpose bit flag

通用位标记

8

2

Compression method

压缩方法

10

2

File last modification time

文件最后修改时间

12

2

File last modification date

文件最后修改日期

14

4

CRC-32

说明采用的算法。

18

4

Compressed size

压缩后的大小。

22

4

Uncompressed size

非压缩的大小。

26

2

File name length (n)

文件名长度

28

2

Extra field length (m)

扩展区长度

30

n

File name

文件名

30+n

m

Extra field

扩展区

2)file data :相应压缩文件的源数据。

3)data descriptor:用于标识该文件压缩结束,该结构只有在相应的header中通用标记字段的第3位设为1时才会出现,紧接在压缩文件源数据后。这个数据描述符只用在不能对输出的 ZIP 文件进行检索时使用。例如:在一个不能检索的驱动器(如:磁带机上)上的 ZIP 文件中。如果是磁盘上的ZIP文件一般没有这个数据描述符。

结构说明如下

   Data descriptor

Offset

Bytes

Description[18]

 0

4

Local file header signature = 0x08074b50

本地header标记

 4

4

CRC-32

CRC-32

 8

4

Compressed size

压缩后大小

 12

4

Uncompressed size

非压缩的大小

2、 压缩的目录源数据

对于待压缩的目录而言,每一个子目录对应一个压缩目录源数据,记录该目录的描述信息。压缩包中所有目录源数据连续存储在整个归档包的最后,这样便于向包中追加新的文件。

结构说明如下

Central directory file header

Offset

Bytes

Description[18]

 0

4

Central directory file header signature =0x02014b50

核心目录文件header标识=(0x02014b50)

 4

2

Version made by

压缩所用的pkware版本

 6

2

Version needed to extract (minimum)

解压所需pkware的最低版本

 8

2

General purpose bit flag

通用位标记

10

2

Compression method

压缩方法

12

2

File last modification time

文件最后修改时间

14

2

File last modification date

文件最后修改日期

16

4

CRC-32

CRC-32算法

20

4

Compressed size

压缩后大小

24

4

Uncompressed size

未压缩的大小

28

2

File name length (n)

文件名长度

30

2

Extra field length (m)

扩展域长度

32

2

File comment length (k)

文件注释长度

34

2

Disk number where file starts

文件开始位置的磁盘编号

36

2

Internal file attributes

内部文件属性

38

4

External file attributes

外部文件属性

42

4

Relative offset of local file header. This is the number of bytes between the start of the first disk on which the file occurs, and the start of the local file header. This allows software reading the central directory to locate the position of the file inside the ZIP file.

本地文件header的相对位移。

46

n

File name

目录文件名

46+n

m

Extra field

扩展域

46+n+m

k

File comment

文件注释内容

3、 目录结束标识结构

目录结束标识存在于整个归档包的结尾,用于标记压缩的目录数据的结束。

结构说明如下

End of central directory record

Offset

Bytes

Description[18]

 0

4

End of central directory signature =0x06054b50

核心目录结束标记(0x06054b50)

 4

2

Number of this disk

当前磁盘编号

 6

2

Disk where central directory starts

核心目录开始位置的磁盘编号

 8

2

Number of central directory records on this disk

该磁盘上所记录的核心目录数量

10

2

Total number of central directory records

核心目录结构总数

12

4

Size of central directory (bytes)

核心目录的大小

16

4

Offset of start of central directory, relative to start of archive

核心目录开始位置相对于archive开始的位移

20

2

Comment length (n)

注释长度

22

n

Comment

注释内容

 转于:http://blog.sina.com.cn/s/blog_4c3591bd0100zzm6.html