# 7-Zip

**7-Zip** 是一款适用于 Windows、Linux 和 macOS 的免费开源文件归档器，由伊戈尔·帕夫洛夫开发，可将一组文件放入称为归档文件的压缩容器中；其原生 7z 格式专为高压缩率而设计<sup>[1](https://www.loc.gov/preservation/digital/formats/fdd/fdd000539.shtml)</sup><sup> • </sup><sup>[2](https://www.7-zip.org/)</sup>。首个测试版于 1999 年 1 月 2 日发布，7z 被指定为 7z.exe 和 7za.exe 程序的默认格式<sup>[1](https://www.loc.gov/preservation/digital/formats/fdd/fdd000539.shtml)</sup>。当前版本为 7-Zip 26.04（2026-10-05），其 64 位 Windows 安装程序大小为 1.6 MB<sup>[2](https://www.7-zip.org/)</sup>。

| 关键事实 | 详情 |
|---|---|
| 开发者与起源 | 伊戈尔·帕夫洛夫；首个测试版于 1999 年 1 月 2 日发布<sup>[1](https://www.loc.gov/preservation/digital/formats/fdd/fdd000539.shtml)</sup> |
| 许可证 | 大部分代码采用 GNU LGPL，部分采用 BSD 3-clause，并附带 unRAR 许可证限制；可在任何计算机上免费使用，包括商业组织<sup>[2](https://www.7-zip.org/)</sup> |
| 原生格式 | 7z：开放架构、AES-256 加密、Unicode 文件名、固实压缩、压缩头、文件大小最高可达 16000000000 GB<sup>[3](https://www.7-zip.org/7z.html)</sup> |
| 默认方法 | LZMA，LZ77 的优化版本，字典大小最高可达 4 GB，解压器代码约 5 KB<sup>[3](https://www.7-zip.org/7z.html)</sup> |
| 格式 | 可打包和解包 7z、XZ、BZIP2、GZIP、TAR、ZIP 和 WIM；可解包更多格式，包括 RAR、ISO、DMG 和 NTFS 镜像<sup>[2](https://www.7-zip.org/)</sup> |
| 当前版本 | 26.04，发布于 2026-10-05；提供 87 种语言的本地化版本<sup>[2](https://www.7-zip.org/)</sup> |

## 7z 格式

7z 格式具有开放架构，因此可以在不更改容器的情况下添加新的压缩、转换或加密方法。截至当前文档所集成的方法包括 LZMA（LZ77 算法的改进优化版本）、LZMA2（改进的 LZMA）、PPMD（德米特里·什卡林的 PPMdH，略有改动）、BZip2（标准 BWT 算法）和 Copy（不压缩）<sup>[3](https://www.7-zip.org/7z.html)</sup>。过滤器对数据进行预处理以提高主方法的压缩率：用于 x86 可执行文件的 BCJ 和 BCJ2，用于 ARM64、ARM-Thumb、ARM32、PowerPC、SPARC 和 IA-64 可执行文件的转换器，用于 WAV 文件的 Delta 转换器，以及 Swap2/Swap4 字节序转换器<sup>[3](https://www.7-zip.org/7z.html)</sup>。

LZMA 是默认的通用压缩方法。其标称特性为：可变字典大小最高可达 4 GB，在 4 GHz CPU 双线程下压缩速度约为 2 至 8 MB/s，单线程解压速度约为 30 至 100 MB/s，解压内存需求小，解压器代码约 5 KB<sup>[3](https://www.7-zip.org/7z.html)</sup>。

**固实压缩。** 7z 可以将许多相似类型的文件压缩为单一流，从而避免跨文件重复冗余并提高压缩率<sup>[1](https://www.loc.gov/preservation/digital/formats/fdd/fdd000539.shtml)</sup>。7z 是 7-Zip 中唯一可以指定固实模式的格式<sup>[4](https://kak.kornev-online.net/FILES/KAK%20-%207-Zip%20command%20line%20tips%20and%20tricks.pdf)</sup>。

**文件结构。** 7z 文件以 32 字节的签名头开始，其前六个字节为 '7'、'z'、0xBC、0xAF、0x27、0x1C，随后是可选的打包流以及由属性 ID 组成的正文，描述头、文件信息、子流和文件夹。该格式使用小端序编码，并为打包流和未压缩数据存储 CRC-32 校验和<sup>[1](https://www.loc.gov/preservation/digital/formats/fdd/fdd000539.shtml)</sup>。没有正式的格式规范；LZMA 压缩规范充当非官方规范，而 py7zr Python 库独立记录了其结构<sup>[1](https://www.loc.gov/preservation/digital/formats/fdd/fdd000539.shtml)</sup>。

## 加密

7-Zip 在 7z 和 ZIP 格式中支持 AES-256 加密，使用 256 位密钥<sup>[3](https://www.7-zip.org/7z.html)</sup><sup> • </sup><sup>[2](https://www.7-zip.org/)</sup>。密钥由用户提供的文本密码通过基于 SHA-256 哈希算法的派生函数导出，并使用大量迭代以增加穷举密码搜索的成本<sup>[3](https://www.7-zip.org/7z.html)</sup>。7z 格式还支持加密文件名<sup>[1](https://www.loc.gov/preservation/digital/formats/fdd/fdd000539.shtml)</sup>。

## 格式与互操作性

7-Zip 可打包和解包 7z、XZ、BZIP2、GZIP、TAR、ZIP 和 WIM，并可解包一长串其他格式，包括 APFS、ARJ、CAB、CHM、CPIO、DMG、ISO、LZH、MSI、NSIS、NTFS、QCOW2、RAR、RPM、SquashFS、UDF、VHD、VMDK 和 Z<sup>[2](https://www.7-zip.org/)</sup>。对于 ZIP 和 GZIP，其声称压缩率比 PKZip 和 WinZip 好 2% 至 10%<sup>[2](https://www.7-zip.org/)</sup>。RAR 支持随时间有所变化：9.20 版仅处理 RAR 2/3/4，而近期版本还支持 RAR5 归档<sup>[5](https://www.7-zip.org/faq.html)</sup>。

存在第三方实现。Apache Commons Compress 使用部分算法读写 7z（写入时支持未压缩、LZMA、LZMA2、BZIP2 和 Deflate；读取时额外支持 AES-256/SHA-256 和 DEFLATE64），自 Compress 1.20 起提供对条目的随机访问，但在固实压缩下这比顺序读取更慢<sup>[6](https://commons.apache.org/proper/commons-compress/examples.html)</sup>。Windows 附带的 tar 工具基于 libarchive 的 bsdtar，可以从命令行创建、列出和提取 .7z 归档<sup>[7](https://learn.microsoft.com/en-us/windows/tar/)</sup>。其他支持 7z 归档的应用程序包括 WinRAR、PowerArchiver、TUGZip 和 IZArc<sup>[3](https://www.7-zip.org/7z.html)</sup>。

## 性能

在 PeaZip 对 1.22 GB 混合语料库的默认基准测试中，7-Zip 在默认 7Z 中等设置下产生了受测应用程序中最佳的压缩率，为 22.75%，而 WinRAR 默认 RAR 设置为 25.30%，任何 ZIP 压缩器均不优于约 31%；压缩耗时 284 秒，而 RAR 为 106 秒，而 7Z 解压仅需 4.4 秒，属于最快之列<sup>[8](https://peazip.github.io/peazip-compression-benchmark.html)</sup>。总体规律是 7Z 和 RAR 以更长的压缩时间为代价获得比 ZIP 更好的压缩率，而解压保持快速，这有利于那些解压频率高于创建频率的归档场景<sup>[8](https://peazip.github.io/peazip-compression-benchmark.html)</sup>。

**调优。** 压缩级别开关（-mx1 至 -mx9）选择默认字典大小。在 24.09 版中这些默认值被提高，例如在 64 位构建中，普通级别（-mx5）从 16 MB 提高到 32 MB，极限级别（-mx9）提高到 256 MB；32 位构建上限为 64 MB<sup>[9](https://www.7-zip.org/history.txt)</sup>。文件排序也很重要：自 15.06 版起，固实归档默认按名称排序文件，而 -mqs 开关恢复旧的按类型排序顺序，当相似文件分散在多个文件夹中时可以提高压缩率<sup>[5](https://www.7-zip.org/faq.html)</sup>。

## 安全性

由于归档文件从不受信任的输入中解析，7-Zip 在其格式处理器中积累了一系列内存安全漏洞记录。2024 年 11 月，欧盟计算机应急响应组报告了 CVE-2024-11477，这是 Zstandard 解压中的一个缺陷，在写入内存之前发生整数下溢，允许远程代码执行；其 CVSS 评分为 7.8，已在 7-Zip 24.07 中修复<sup>[10](https://cert.europa.eu/publications/security-advisories/2024-118/)</sup>。变更日志记录了更多轮修复：25.01 版通过更改提取期间的符号链接处理解决了 CVE-2025-55188，26.01 版修复了八个 CVE，涵盖 SquashFS、UEFI、UDF、WIM、NTFS 和 Ar 处理器中的越界读取和内存信息泄露，26.02 版修复了 CVE-2026-14266，即 XZ 解压中基于堆的缓冲区溢出，可导致远程代码执行<sup>[9](https://www.7-zip.org/history.txt)</sup>。GitHub 安全实验室对 26.00 问题的协调披露指出，这些缺陷跨越 7z、SquashFS、UDF、UEFI、WIM 和 Ar 格式，可能导致系统完整性受损或敏感数据暴露<sup>[11](https://securitylab.github.com/advisories/GHSL-2026-115_GHSL-2026-122_7-zip/)</sup>。7-Zip 不会自我更新；用户必须手动安装新版本<sup>[12](https://www.pcgamer.com/software/security/its-probably-time-to-update-7-zip-as-the-app-has-just-been-patched-to-fix-a-pretty-big-vulnerability/)</sup>。

## References

1. [7z File Format, Library of Congress Sustainable Digital Formats](https://www.loc.gov/preservation/digital/formats/fdd/fdd000539.shtml)
2. [7-Zip official homepage](https://www.7-zip.org/)
3. [7z Format, 7-zip.org](https://www.7-zip.org/7z.html)
4. [KAK - 7-Zip command line tips and tricks](https://kak.kornev-online.net/FILES/KAK%20-%207-Zip%20command%20line%20tips%20and%20tricks.pdf)
5. [7-Zip Frequently Asked Questions](https://www.7-zip.org/faq.html)
6. [Apache Commons Compress User Guide](https://commons.apache.org/proper/commons-compress/examples.html)
7. [tar on Windows, Microsoft Learn](https://learn.microsoft.com/en-us/windows/tar/)
8. [Compression benchmark: 7-Zip, PeaZip, WinRar, WinZip comparison, PeaZip](https://peazip.github.io/peazip-compression-benchmark.html)
9. [HISTORY of the 7-Zip, 7-zip.org](https://www.7-zip.org/history.txt)
10. [Security Advisory 2024-118: Critical Vulnerability in 7-Zip, CERT-EU](https://cert.europa.eu/publications/security-advisories/2024-118/)
11. [GHSL-2026-115–GHSL-2026-122: Various memory access violations in 7-Zip, GitHub Security Lab](https://securitylab.github.com/advisories/GHSL-2026-115_GHSL-2026-122_7-zip/)
12. [It's probably time to update 7-Zip as the app has just been patched to fix a pretty big vulnerability, PC Gamer](https://www.pcgamer.com/software/security/its-probably-time-to-update-7-zip-as-the-app-has-just-been-patched-to-fix-a-pretty-big-vulnerability/)

---
*Initially written Sep 17, 2026 · Reviewed: Sep 17, 2026; Oct 15, 2026 · Edited: Oct 15, 2026 · Last review: Oct 15, 2026*

Topic: 技术与人造世界 › 计算技术与数字系统 › 软件与编程 › Operating systems

Copyright 2026 Edgepedia

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license

Source: https://www.edgepedia.org/zh/7-zip

English original: https://www.edgepedia.org/7-zip
