Coomon header has a CRC16 for check of header.
So all Level 1 headers with one or more extended headers,
all Level 2 headers, and all Level 3 headers need to have
common header.
offset | common header level 1 or 2 no additional info |
common header level 3 no additional info |
common header level 1 or 2 (UNLHA, Unix) with additional info |
common header level 3 (UNLHA, Unix) with additional info |
common header level 1 or 2 (OS/2) with additional info |
common header level 3 (OS/2) with additional info |
offset |
00 | Extended header identifier |
Extended header identifier |
Extended header identifier |
Extended header identifier |
Extended header identifier |
Extended header identifier |
00 |
01 | CRC of header(L) | CRC of header(L) | CRC of header(L) | CRC of header(L) | CRC of header(L) | CRC of header(L) | 01 |
02 | CRC of header(H) | CRC of header(H) | CRC of header(H) | CRC of header(H) | CRC of header(H) | CRC of header(H) | 02 |
03 | Size of next extended header(L) |
Size of next extended header(LL) |
Additional info | Additional info | Additional info(1) | Additional indo(1) | 03 |
04 | Size of next extended header(L) |
Size of next extended header(LH) |
Size of next extended header(L) |
Size of next extended header(LL) |
... | ... | ?? |
05 | Size of next extended header(HL) |
Size of next extended header(H) |
Size of next extended header(LH) |
... | Additional info(end) | size - 5 | |
06 | Size of next extended header(HH) |
Size of next extended header(HL) |
... | Size of next extended header(LL) |
size - 4 | ||
07 | Size of next extended header(HH) |
Additional info(end) | Size of next extended header(LH) |
size - 3 | |||
08 | Size of next extended header(L) |
Size of next extended header(HL) |
size - 2 | ||||
09 | Size of next extended header(H) |
Size of next extended header(HH) |
size - 1 |
+0 | +1 | +2 | +3 | +4 | +5 | +6 | +7 | +8 | +9 | +A | +B | +C | +D | +E | +F | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | A | B | C | D | E | F | ||
0x0000 | 2E | 00 | 2D | 6C | 68 | 30 | 2D | 00 | 00 | 00 | 00 | 00 | 00 | 00 | 00 | 0C | . | . | - | l | h | 0 | - | . | . | . | . | . | . | . | . | ||
0x0010 | EE | 27 | 3D | 20 | 02 | 00 | 00 | 4A | 05 | 00 | 00 | CF | 4F | 07 | 00 | 01 | î | ' | = | . | . | J | . | . | Ï | O | . | ||||||
0x0020 | 74 | 65 | 73 | 74 | 08 | 00 | 02 | 74 | 65 | 73 | 74 | FF | 00 | 00 | -- | -- | t | e | s | t | . | t | e | s | t | ÿ | . | . | - | - |
Extended header identifier |
This is the identifier for specifying an extended header.
You must set 0x00 in common header. |
CRC of header |
This is the CRC16 of the whole header.
You must use 0 in this field to calc CRC16.
CRC16 polynomial is x16 + x15 + x2 + 1,
and initial value is 0.
CRC of header is 0x4FCF in the foregoing sample. |
Additional info |
This is a Additional information.
For details, refer to the after-mentioned About additional info.
This field may not exist.
According to header.tex which is attached LHA for OS/2,
the size of this field is "n" which means variable size,
and you must not assume that size of this field is 0.
Additional info is not exist in the foregoing sample. |
Size of next extended header |
This is the byte count of following extended header.
Set this field as 0, when there is not following extended header.
Size of next extended header is 0x0005 in the foregoing sample. |
bit NO | caption | description | |||||
M L B /\ \/ M S B |
7 - 3 | Time zone(1) |
The time zone of the district. In reference
|
||||
2 | Encryption flag |
Details are not set to encryption. |
|||||
1 | Time zone(2) |
Local(1)/UTC(0) Time zone(2) is different than Time zone(1). However I can't understand well. It is unknown also about the adaptation range. |
|||||
0 | Conversion of new-line code |
Text(1)/Binary(0) New-line code is "\r\n" in Windows, '\r' in Macintosh, '\n' in Unix. This is the flag for conversion from the new-line code of OS which compressed the file to the new-line code of OS which extracted the file. However most editors correspond to these new-line codes now, and conversion may introduce confusion when conversion can not operate correctly, so I think that conversion is unneedful. |
offset | Filename header Level 1 and 2 |
Filename header Level 3 |
00 | Extended header identifier | Extended header identifier |
01 | Filename(1) | Filename(1) |
?? | ... | ... |
size - 5 | ... | Filename(end) |
size - 4 | ... | Size of next extended header(LL) |
size - 3 | Filename(end) | Size of next extended header(LH) |
size - 2 | Size of next extended header(L) | Size of next extended header(HL) |
size - 1 | Size of next extended header(H) | Size of next extended header(HH) |
+0 | +1 | +2 | +3 | +4 | +5 | +6 | +7 | +8 | +9 | +A | +B | +C | +D | +E | +F | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | A | B | C | D | E | F | ||
0x0000 | 2E | 00 | 2D | 6C | 68 | 30 | 2D | 00 | 00 | 00 | 00 | 00 | 00 | 00 | 00 | 0C | . | . | - | l | h | 0 | - | . | . | . | . | . | . | . | . | ||
0x0010 | EE | 27 | 3D | 20 | 02 | 00 | 00 | 4A | 05 | 00 | 00 | CF | 4F | 07 | 00 | 01 | î | ' | = | . | . | J | . | . | Ï | O | . | ||||||
0x0020 | 74 | 65 | 73 | 74 | 08 | 00 | 02 | 74 | 65 | 73 | 74 | FF | 00 | 00 | -- | -- | t | e | s | t | . | t | e | s | t | ÿ | . | . | - | - |
+0 | +1 | +2 | +3 | +4 | +5 | +6 | +7 | +8 | +9 | +A | +B | +C | +D | +E | +F | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | A | B | C | D | E | F | ||
0x0000 | 2E | 00 | 2D | 6C | 68 | 64 | 2D | 00 | 00 | 00 | 00 | 00 | 00 | 00 | 00 | 8F | . | . | - | l | h | d | - | . | . | . | . | . | . | . | . | | |
0x0010 | 88 | 2E | 3D | 20 | 02 | 00 | 00 | 4A | 05 | 00 | 00 | 24 | 07 | 03 | 00 | 01 | | . | = | . | . | J | . | . | $ | . | |||||||
0x0020 | 0C | 00 | 02 | 74 | 65 | 73 | 74 | FF | 64 | 69 | 72 | FF | 00 | 00 | -- | -- | . | t | e | s | t | ÿ | d | i | r | ÿ | . | . | - | - |
Extended header identifier |
This is the identifier for specifying an extended header.
You must set 0x01 in filename header. |
Filename |
This is the filename.
Filename is "test" in the foregoing sample1.
Filename is not exist foregoing sample2. |
Size of next extended header |
This is the byte count of following extended header.
Set this field as 0, when there is not following extended header.
Size of next extended header is 0x0008 in the foregoing sample1,
and 0x000C in the foregoing sample2. |
offset | directory name header level 1 or 2 |
directory name header level 3 |
00 | Extended header identifier | Extended header identifier |
01 | Directory name(1) | Directory name(1) |
?? | ... | ... |
size - 5 | ... | Directory name(end) |
size - 4 | ... | Size of next extended header(LL) |
size - 3 | Directory name(end) | Size of next extended header(LH) |
size - 2 | Size of next extended header(L) | Size of next extended header(HL) |
size - 1 | Size of next extended header(H) | Size of next extended header(HH) |
+0 | +1 | +2 | +3 | +4 | +5 | +6 | +7 | +8 | +9 | +A | +B | +C | +D | +E | +F | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | A | B | C | D | E | F | ||
0x0000 | 2E | 00 | 2D | 6C | 68 | 30 | 2D | 00 | 00 | 00 | 00 | 00 | 00 | 00 | 00 | 0C | . | . | - | l | h | 0 | - | . | . | . | . | . | . | . | . | ||
0x0010 | EE | 27 | 3D | 20 | 02 | 00 | 00 | 4A | 05 | 00 | 00 | CF | 4F | 07 | 00 | 01 | î | ' | = | . | . | J | . | . | Ï | O | . | ||||||
0x0020 | 74 | 65 | 73 | 74 | 08 | 00 | 02 | 74 | 65 | 73 | 74 | FF | 00 | 00 | -- | -- | t | e | s | t | . | t | e | s | t | ÿ | . | . | - | - |
+0 | +1 | +2 | +3 | +4 | +5 | +6 | +7 | +8 | +9 | +A | +B | +C | +D | +E | +F | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | A | B | C | D | E | F | ||
0x0000 | 2E | 00 | 2D | 6C | 68 | 64 | 2D | 00 | 00 | 00 | 00 | 00 | 00 | 00 | 00 | 8F | . | . | - | l | h | d | - | . | . | . | . | . | . | . | . | | |
0x0010 | 88 | 2E | 3D | 20 | 02 | 00 | 00 | 4A | 05 | 00 | 00 | 24 | 07 | 03 | 00 | 01 | | . | = | . | . | J | . | . | $ | . | |||||||
0x0020 | 0C | 00 | 02 | 74 | 65 | 73 | 74 | FF | 64 | 69 | 72 | FF | 00 | 00 | -- | -- | . | t | e | s | t | ÿ | d | i | r | ÿ | . | . | - | - |
Extended header identifier |
This is the identifier for specifying an extended header.
You must set 0x02 in directory name header. |
Directory name |
This is the path from the base directory
to the parent directory of compressed file.
Directory name is "test/" in the foregoing sample1.
Directory name is "test/dir/" in the foregoing sample2.
(It is converted from 0xFF to '/' for easier to understand.) |
Size of next extended header |
This is the byte count of following extended header.
Set this field as 0, when there is not following extended header.
Size of next extended header is 0x0000
which means there is no more following extended header,
in both of foregoing sample. |
offset | Multi-disc header level 1 or 2 |
Description |
00 | Extended header identifier |
This is the identifier for specifying an extended header.
You must set 0x39 in multi-disc header. |
01 | Span mode |
This is the identifier the mode of the data following this header.
For details, refer to the after-mentioned About span mode. |
02 | Beginning offset(LL) |
This is the position which shows where the divided data following this header
should fit into the whole compression data. |
03 | Beginning offset(LH) | |
04 | Beginning offset(HL) | |
05 | Beginning offset(HH) | |
06 | Size of data(LL) |
This is the byte count of the divided data following this header. |
07 | Size of data(LH) | |
08 | Size of data(HL) | |
09 | Size of data(HH) | |
10 | Size of next extended header(L) | This is the byte count of following extended header. Set this field as 0, when there is not following extended header. |
11 | Size of next extended header(H) |
val | Span mode | description |
0 | SPAN_COMPLETE |
It means that the data following this header is not divided. In this case, multi-disc header is not needed, so you should not use this value. |
1 | SPAN_MORE |
It means that the data following this header is one of divided data
and following data is not last data.
You should continue to extract until
you find a header that has span_mode as SPAN_LAST. |
2 | SPAN_LAST |
It means that the data following this header is last of divided data. |
offset | Comment header level 1 and 2 |
Comment header level 3 |
00 | Extended header identifier | Extended header identifier |
01 | Comment(1) | Comment(1) |
?? | ... | ... |
size - 5 | ... | Comment(end) |
size - 4 | ... | Size of next extended header(LL) |
size - 3 | Comment(end) | Size of next extended header(LH) |
size - 2 | Size of next extended header(L) | Size of next extended header(HL) |
size - 1 | Size of next extended header(H) | Size of next extended header(HH) |
+0 | +1 | +2 | +3 | +4 | +5 | +6 | +7 | +8 | +9 | +A | +B | +C | +D | +E | +F | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | A | B | C | D | E | F | ||
0x0000 | 42 | 00 | 2D | 6C | 68 | 30 | 2D | 00 | 00 | 00 | 00 | 00 | 00 | 00 | 00 | 0C | B | . | - | l | h | 0 | - | . | . | . | . | . | . | . | . | ||
0x0010 | EE | 27 | 3D | 20 | 02 | 00 | 00 | 4D | 07 | 00 | 01 | 74 | 65 | 73 | 74 | 08 | î | ' | = | . | . | M | . | t | e | s | t | ||||||
0x0020 | 00 | 02 | 74 | 65 | 73 | 74 | FF | 0F | 00 | 3F | 63 | 6F | 6D | 6D | 65 | 6E | . | t | e | s | t | ÿ | . | ? | c | o | m | m | e | n | |||
0x0030 | 74 | 20 | 74 | 65 | 73 | 74 | 05 | 00 | 40 | 20 | 20 | 05 | 00 | 00 | B8 | 84 | t | t | e | s | t | . | @ | . | . | ¸ | | ||||||
0x0040 | 00 | 00 | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | . | . | - | - | - | - | - | - | - | - | - | - | - | - | - | - |
Extended header identifier |
This is the identifier for specifying an extended header.
You must set 0x3F in comment header. |
Comment |
This is a comment text of the compressed file.
Comment is "comment test" in foregoing sample. |
Size of next extended header |
This is the byte count of following extended header.
Set this field as 0, when there is not following extended header.
Size of next extended header is 0x0005 in foregoing sample. |