README.md
1# minizip 2.8.1
2
3minizip is a zip manipulation library written in C that is supported on Windows, macOS, and Linux.
4
5[![License: Zlib](https://img.shields.io/badge/license-zlib-lightgrey.svg)](https://github.com/nmoinvaz/minizip/blob/master/LICENSE)
6[![Code Quality: Cpp](https://img.shields.io/lgtm/grade/cpp/g/nmoinvaz/minizip.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/nmoinvaz/minizip/context:cpp)
7
8Maintained by Nathan Moinvaziri.
9
10## Branches
11
12| Name | State | Version | Description |
13|:- |:-:|:-:|:-|
14|[master](https://github.com/nmoinvaz/minizip/tree/master)|Active [![Master Branch Status](https://api.travis-ci.org/nmoinvaz/minizip.svg?branch=master)](https://travis-ci.org/nmoinvaz/minizip/branches)|2.x|Modern rewrite of 1.2 branch that includes more advanced features, improvements in code maintainability and readability, and the reduction of duplicate code. Compatibility layer provided for older versions.|
15|[dev](https://github.com/nmoinvaz/minizip/tree/dev)|Active [![Dev Branch Status](https://api.travis-ci.org/nmoinvaz/minizip.svg?branch=dev)](https://travis-ci.org/nmoinvaz/minizip/branches)|2.x|Latest development code|
16|[1.2](https://github.com/nmoinvaz/minizip/tree/1.2)|Stale| 1.x|Drop-in replacement for zlib's minizip that includes WinZip AES encryption, disk splitting, I/O buffering and some additional fixes.|
17|[1.1](https://github.com/nmoinvaz/minizip/tree/1.1)|Stale| 1.x|Original minizip as of zlib 1.2.11.|
18
19## History
20
21Minizip was originally developed by [Gilles Vollant](https://www.winimage.com/zLibDll/minizip.html) and
22had been contributed to by many people. As part of the zlib distribution, Mark Adler still maintains the
23original [minizip](https://github.com/madler/zlib/tree/master/contrib/minizip) project which is included in this repository as a reference.
24
25My work with the minizip library began in 2006 when I started submitting bugs I found to
26Gilles Vollant. In 2010, I implemented some additional features like WinZip AES encryption, disk splitting, and
27I/O buffering that were necessary for another project I was working on. Shortly after, I created this public repository
28so I could share these and other improvements with the rest of the world. I have been maintaining and actively
29developing this code base ever since. At the beginning of 2017, I began the work to refactor and rewrite
30the library as version 2 because it had become difficult to maintain and code readability suffered over the years.
31
32## Features
33
34+ Creating and extracting zip archives.
35+ Adding and removing entries from zip archives.
36+ Read and write raw zip entry data.
37+ Reading and writing zip archives from memory.
38+ Zlib, BZIP2, and LZMA compression methods.
39+ Password protection through Traditional PKWARE and [WinZIP AES](https://www.winzip.com/aes_info.htm) encryption.
40+ Buffered streaming for improved I/O performance.
41+ NTFS timestamp support for UTC last modified, last accessed, and creation dates.
42+ Disk split support for splitting zip archives into multiple files.
43+ Preservation of file attributes across file systems.
44+ Unicode filename support through UTF-8 encoding.
45+ Legacy character encoding support CP437, CP932, CP936, CP950.
46+ Turn off compilation of compression, decompression, or encryption.
47+ Windows (Win32 & WinRT), macOS and Linux platform support.
48+ Streaming interface for easy implementation of additional platforms.
49+ Support for Apple's compression library ZLIB implementation.
50+ Zero out local file header information.
51+ Zip/unzip of central directory to reduce size.
52+ Ability to generate and verify CMS signature for each entry.
53+ Recover the central directory if it is corrupt or missing.
54+ Example minizip command line tool.
55
56## Build
57
58To generate project files for your platform:
59
601. [Download and install](https://cmake.org/install/) cmake.
612. Run cmake in the minizip directory.
62
63```
64cmake . -DBUILD_TEST=ON
65cmake --build .
66```
67
68## Build Options
69
70| Name | Description | Default Value |
71|:- |:-|:-:|
72| USE_COMPAT | Enables compatibility layer | ON |
73| USE_ZLIB | Enables ZLIB compression | ON |
74| USE_BZIP2 | Enables BZIP2 compression | ON |
75| USE_LZMA | Enables LZMA compression | ON |
76| USE_PKCRYPT | Enables PKWARE traditional encryption | ON |
77| USE_WZAES | Enables WinZIP AES encryption | ON |
78| USE_LIBCOMP | Enables Apple compression | OFF |
79| USE_OPENSSL | Enables OpenSSL encryption | OFF |
80| USE_BRG | Enables Brian Gladman's library | OFF |
81| COMPRESS_ONLY | Only support compression | OFF |
82| DECOMPRESS_ONLY | Only support decompression | OFF |
83| BUILD_TEST | Builds minizip test executable | OFF |
84| BUILD_UNIT_TEST | Builds minizip unit test project | OFF |
85| BUILD_FUZZ_TEST | Builds minizip fuzz executables | OFF |
86
87## Contents
88
89| File(s) | Description |
90|:- |:-|
91| minizip.c | Sample application |
92| mz_compat.\* | Minizip 1.x compatibility layer |
93| mz.h | Error codes and flags |
94| mz_os\* | Platform specific file/utility functions |
95| mz_crypt\* | Configuration specific crypto/hashing functions |
96| mz_strm.\* | Stream interface |
97| mz_strm_buf.\* | Buffered stream |
98| mz_strm_bzip.\* | BZIP2 stream using libbzip2 |
99| mz_strm_libcomp.\* | Apple compression stream |
100| mz_strm_lzma.\* | LZMA stream using liblzma |
101| mz_strm_mem.\* | Memory stream |
102| mz_strm_split.\* | Disk splitting stream |
103| mz_strm_pkcrypt.\* | PKWARE traditional encryption stream |
104| mz_strm_os\* | Platform specific file stream |
105| mz_strm_wzaes.\* | WinZIP AES stream |
106| mz_strm_zlib.\* | Deflate stream using zlib |
107| mz_zip.\* | Zip format |
108| mz_zip_rw.\* | Zip reader/writer |
109
110## Third-Party Libraries
111
112+ [zlib](https://zlib.net/) written by Mark Adler and Jean-loup Gailly.
113 + Not included in this repository
114 + Or alternatively, [zlib-ng](https://github.com/Dead2/zlib-ng) by Hans Kristian Rosbach
115+ [BZIP2](https://www.sourceware.org/bzip2/) written by Julian Seward.
116+ [liblzma](https://tukaani.org/xz/) written by Lasse Collin.
117 + Modifications were made to support the ZIP file format specification
118+ [AES](https://github.com/BrianGladman/aes) and [SHA](https://github.com/BrianGladman/sha) libraries of Brian Gladman.
119
120## Acknowledgments
121
122Thanks to [Gilles Vollant](https://www.winimage.com/zLibDll/minizip.html) on which this work is originally based on.
123
124Thanks go out to all the people who have taken the time to contribute code reviews, testing and/or patches. This project would not have been nearly as good without you.
125
126The [ZIP format](https://github.com/nmoinvaz/minizip/blob/master/doc/appnote.txt) was defined by Phil Katz of PKWARE.
127