Encoding rules for compressed packet types
bit definition (lowest bit → high bit)
Binary bits
Compression type
| 00000001 (bit0) |
.7z |
| 00000010 (bit1) |
.zip |
| 00000100 (bit2) |
.tar |
| 00001000 (bit3) |
.gz |
| 00010000 (bit4) |
.xz |
Parsing rules
highest bit (leftmost bit) decision
If the highest bit = 1→ resolves from right to left (low → High)
If the highest bit = 0→ resolves from left to right (high → low)
extension generation
Each 1 bit corresponds to an extension
Parsing order determines the order of the extensions:
Right-to-left: the first parsed extension is the inner package
From left to right: the first parsed extension is the outer package
Notes:
A single type mandates that the most significant bit must be 0 when there is only one compression type (for example. 7z can only be represented as 00000001, not 10000001) .
example illustration
Binary value
The highest bit
Analytical direction
The order of the extensions
The final extension
| 10001100 |
1 |
right→left |
.tar → .gz |
.tar.gz |
| 00001100 |
0 |
left→right |
.gz → .tar |
.gz.tar |
| 00000001 |
0 |
left→right |
.7z |
.7z |
| 00101000 |
0 |
left→right |
.gz → .xz |
.gz.xz |
| 10100001 |
1 |
right→left |
.7z → .xz |
.7z.xz |
Key points
- Bit Order: the hierarchy of extensions is determined by the direction of parsing (the inner package parses first) .
- High Bit Limit: the highest bit must be 0 for a single compression type to avoid triggering the multi-type parsing logic by mistake.
- Invalid Bit: undefined bit (bit5-bit6) is always 0 and ignored when parsing.