1 7z Format description (2.30 Beta 25)
2 -----------------------------------
4 This file contains description of 7z archive format.
5 7z archive can contain files compressed with any method.
6 See "Methods.txt" for description for defined compressing methods.
9 Format structure Overview
10 -------------------------
12 Some fields can be optional.
18 [PackedStreamsForHeaders]
55 Properties[PropertiesSize]
58 BindPairsInfo[NumBindPairs]
65 UnPackSize[Folders][Folders.NumOutstreams]
70 NumUnPackStreamsInFolders[NumFolders];
77 (Same as in AdditionalStreams)
94 (Same as in AdditionalStreams)
99 Notes about Notation and encoding
100 ---------------------------------
102 7z uses little endian encoding.
104 7z archive format has optional headers that are marked as
109 REAL_UINT64 means real UINT64.
111 UINT64 means real UINT64 encoded with the following scheme:
113 Size of encoding sequence depends from first byte:
114 First_Byte Extra_Bytes Value
116 0xxxxxxx : ( xxxxxxx )
117 10xxxxxx BYTE y[1] : ( xxxxxx << (8 * 1)) + y
118 110xxxxx BYTE y[2] : ( xxxxx << (8 * 2)) + y
120 1111110x BYTE y[6] : ( x << (8 * 6)) + y
121 11111110 BYTE y[7] : y
122 11111111 BYTE y[8] : y
133 0x02 = kArchiveProperties,
135 0x03 = kAdditionalStreamsInfo,
136 0x04 = kMainStreamsInfo,
141 0x08 = kSubStreamsInfo,
148 0x0C = kCodersUnPackSize,
149 0x0D = kNumUnPackStream,
156 0x12 = kCreationTime,
157 0x13 = kLastAccessTime,
158 0x14 = kLastWriteTime,
159 0x15 = kWinAttributes,
162 0x17 = kEncodedHeader,
170 BYTE kSignature[6] = {'7', 'z', 0xBC, 0xAF, 0x27, 0x1C};
174 BYTE Major; // now = 0
175 BYTE Minor; // now = 2
178 UINT32 StartHeaderCRC;
182 REAL_UINT64 NextHeaderOffset
183 REAL_UINT64 NextHeaderSize
188 ...........................
193 BYTE NID::kArchiveProperties (0x02)
200 BYTE PropertyData[PropertySize];
205 ~~~~~~~~~~~~~~~~~~~~~
207 if (AllAreDefined == 0)
212 UINT32 CRCs[NumDefined]
217 BYTE NID::kPackInfo (0x06)
219 UINT64 NumPackStreams
222 BYTE NID::kSize (0x09)
223 UINT64 PackSizes[NumPackStreams]
227 BYTE NID::kCRC (0x0A)
228 PackStreamDigests[NumPackStreams]
241 0:3 DecompressionMethod.IDSize
247 1 - There Are Attributes
249 0 - Last Method in Alternative_Method_List
250 1 - There are more alternative methods
252 BYTE DecompressionMethod.ID[DecompressionMethod.IDSize]
256 UINT64 NumOutStreams;
258 if (DecompressionMethod[0] != 0)
260 UINT64 PropertiesSize
261 BYTE Properties[PropertiesSize]
265 NumBindPairs = NumOutStreamsTotal - 1;
273 NumPackedStreams = NumInStreamsTotal - NumBindPairs;
274 if (NumPackedStreams > 1)
275 for(NumPackedStreams)
286 BYTE NID::kUnPackInfo (0x07)
289 BYTE NID::kFolder (0x0B)
297 UINT64 DataStreamIndex
301 BYTE ID::kCodersUnPackSize (0x0C)
303 for(Folder.NumOutStreams)
308 BYTE NID::kCRC (0x0A)
309 UnPackDigests[NumFolders]
320 BYTE NID::kSubStreamsInfo; (0x08)
323 BYTE NID::kNumUnPackStream; (0x0D)
324 UINT64 NumUnPackStreamsInFolders[NumFolders];
329 BYTE NID::kSize (0x09)
335 BYTE NID::kCRC (0x0A)
336 Digests[Number of streams with unknown CRC]
365 BYTE NID::kFilesInfo; (0x05)
390 case kCreationTime: (0x12)
391 case kLastAccessTime: (0x13)
392 case kLastWriteTime: (0x14)
394 if (AllAreDefined == 0)
414 wchar_t Names[NameSize];
421 if (AllAreDefined == 0)
424 BIT AttributesAreDefined
430 for(Definded Attributes)
439 BYTE NID::kHeader (0x01)
446 BYTE NID::kAdditionalStreamsInfo; (0x03)
451 BYTE NID::kMainStreamsInfo; (0x04)
465 BYTE NID::kEncodedHeader; (0x17)
466 StreamsInfo for Encoded Header