| 1 | # MZ_ZIP_FILE |
| 2 | |
| 3 | Zip entry information structure. The _mz_zip_file_ structure is populated when reading zip entry information and can be used to populate zip entry information when writing zip entries. |
| 4 | |
| 5 | |Type|Name|Description|[PKWARE zip app note](zip/appnote.txt) section| |
| 6 | |-|-|-|-| |
| 7 | |uint16_t|version_madeby|Version made by field|4.4.2| |
| 8 | |uint16_t|version_needed|Version needed to extract|4.4.3| |
| 9 | |uint16_t|flag|General purpose bit flag|4.4.4| |
| 10 | |uint16_t|compression_method|Compression method|4.4.5 [MZ_COMPRESS_METHOD](mz_compress_method.md)| |
| 11 | |time_t|modified_date|Last modified unix timestamp|4.4.6, 4.5.5, 4.5.7| |
| 12 | |time_t|accessed_date|Last accessed unix timestamp|4.5.5, 4.5.7| |
| 13 | |time_t|creation_date|Creation date unix timestamp|4.5.5| |
| 14 | |uint32_t|crc|CRC32-B hash of uncompressed data|4.4.7| |
| 15 | |int64_t|compressed_size|Compressed size|4.4.8| |
| 16 | |int64_t|uncompressed_size|Uncompressed size|4.4.9| |
| 17 | |uint16_t|filename_size|Filename length|4.4.10| |
| 18 | |uint16_t|extrafield_size|Extrafield length|4.4.11| |
| 19 | |uint16_t|comment_size|Comment size|4.4.12| |
| 20 | |uint32_t|disk_number|Starting disk number|4.4.13| |
| 21 | |int64_t|disk_offset|Starting disk offset|4.4.16| |
| 22 | |uint16_t|internal_fa|Internal file attributes|4.4.14| |
| 23 | |uint32_t|external_fa|External file attributes|4.4.15| |
| 24 | |const char *|filename|Filename UTF-8 null-terminated string|4.4.17| |
| 25 | |const uint8_t *|extrafield|Extrafield buffer array|4.4.28| |
| 26 | |const char *|comment|Comment UTF-8 null-terminated string|4.4.18| |
| 27 | |uint16_t|zip64|Zip64 extension mode|[MZ_ZIP64](mz_zip64.md)| |
| 28 | |uint16_t|aes_version|WinZip AES version|[WinZip AES App Note](zip/winzip_aes.md)| |
| 29 | |uint8_t|aes_strength|WinZip AES encryption strength|[WinZip AES App Note](zip/winzip_aes.md)| |
| 30 | |
| 31 | For more information about each field please consult the referenced app note section. |
| 32 | |
| 33 | ## Extended Notes |
| 34 | |
| 35 | ### verison_madeby |
| 36 | |
| 37 | > The upper byte indicates the compatibility of the file attribute information... The lower byte indicates the ZIP specification version... supported by the software used to encode the file. |
| 38 | |
| 39 | The preprocessor define `MZ_VERSION_MADEBY` contains the version made by value for the current compiler runtime. To get the file attribute information use the preprocessor define `MZ_HOST_SYSTEM(version_madeby)`. |
| 40 | |
| 41 | ### version_needed |
| 42 | |
| 43 | When writing zip entries, this will automatically be filled in if the value is zero. |
| 44 | |
| 45 | ### flag |
| 46 | |
| 47 | |Flag|Value|Description| |
| 48 | |-|-|-| |
| 49 | | MZ_ZIP_FLAG_ENCRYPTED | 0x1 | Entry is encrypted. If using AES encryption `aes_version` needs to be set to `MZ_AES_VERSION` | |
| 50 | | MZ_ZIP_FLAG_LZMA_EOS_MARKER | 0x2 | Entry contains LZMA end of stream marker | |
| 51 | | MZ_ZIP_FLAG_DEFLATE_MAX | 0x2 | Entry compressed with deflate max algorithm | |
| 52 | | MZ_ZIP_FLAG_DEFLATE_NORMAL | 0 | Entry compressed with deflate normal algorithm | |
| 53 | | MZ_ZIP_FLAG_DEFLATE_FAST | 0x4 | Entry compressed with deflate fast algorithm | |
| 54 | | MZ_ZIP_FLAG_DEFLATE_SUPER_FAST | MAX + FAST | Entry compressed with deflate super fast algorithm | |
| 55 | | MZ_ZIP_FLAG_DATA_DESCRIPTOR | 0x08 | Entry contains data descriptor bytes at the end of the compressed content which contain the compressed and uncompressed size. Local file header contains zeros for these values. | |
| 56 | | MZ_ZIP_FLAG_UTF8 | 0x800 | Entry filename is UTF-8 encoded | |
| 57 | | MZ_ZIP_FLAG_MASK_LOCAL_INFO | 0x2000 | Local file header info is masked | |
| 58 | |
| 59 | ### creation_date |
| 60 | |
| 61 | Creation date is only supported on Windows. |
| 62 | |
| 63 | ### external_fa |
| 64 | |
| 65 | External file attributes. These attributes are native host system attribute values for the entry. To get the host system use `MZ_HOST_SYSTEM(version_madeby)`. It is possible to convert from one host system's attributes to another using `mz_zip_attrib_convert`. |
| 66 | |
| 67 | ### aes_version |
| 68 | |
| 69 | This attribute must be set to `MZ_AES_VERSION` when AES encryption is used. |
| 70 | |
| 71 | ### aes_strength |
| 72 | |
| 73 | AES encryption strength, by default 256-bit encryption is used for compression. |
| 74 | |
| 75 | |Flag|Value|Description| |
| 76 | |-|-|-| |
| 77 | | MZ_AES_STRENGTH_128 | 0x01 | 128-bit AES encryption | |
| 78 | | MZ_AES_STRENGTH_192 | 0x02 | 192-bit AES encryption | |
| 79 | | MZ_AES_STRENGTH_256 | 0x03 | 256-bit AES encryption | |