An ARJ archive is a main header, then a local file header and the compressed data for
each file, then an end marker. Both kinds of header have the same frame and share most
of their first 34 bytes. This page follows Robert Jung’s technical note
TECHNOTE.DOC (the 1994 edition shipped with ARJ 2.4x); fields added by
later ARJ versions are marked as such and come from the open-source ARJ and the parsers
built on it. Numbers are little-endian.
Header frame
| Offset | Size | Name | Description |
|---|---|---|---|
0 | 2 | Header ID | 60 EA (the number EA60). |
2 | 2 | Basic header size | Bytes from first_hdr_size to the end of the comment’s NUL: first_hdr_size + name length + 1 + comment length + 1. At most 2,600. 0 marks the end of the archive. |
4 | … | Basic header | The fixed fields (main or local, below), any extra data, then the name and the comment, each ending with a NUL. |
| … | 4 | Basic header CRC | CRC-32 of the basic header (from offset 4, the size given at offset 2). |
| … | 2 | Extended header size | 0 when there is none (the usual case). |
| … | … | Extended header | Unused by ARJ 2.4x; the size and data repeat until a size of 0. |
| … | 4 | Extended header CRC | CRC-32 of that extended header. Absent when the size is 0. |
The technical note warns that older ARJ, AV.C and UNARJ.C
skip only 2 bytes for an extended header’s CRC instead of 4; it did not matter because
no ARJ version then wrote extended headers.
The CRC is the standard CRC-32 of ZIP (polynomial EDB88320, start
FFFFFFFF, final value inverted); the note gives no parameters and points
to UNARJ’s source, which uses this one.
Main header
Offsets are from the start of the header ID. first_hdr_size is 30 in
ARJ 2.4x archives; later versions write 34 and add the bytes at 34 to 37.
| Offset | Size | Name | Description |
|---|---|---|---|
4 | 1 | first_hdr_size | Size of the fixed part and extra data, counted from this byte. |
5 | 1 | Archiver version | Version of ARJ that made the archive. |
6 | 1 | Minimum version to extract | |
7 | 1 | Host OS | See host OS. |
8 | 1 | ARJ flags | See main header flags. |
9 | 1 | Security version | 2 is current. |
10 | 1 | File type | Always 2 in the main header. |
11 | 1 | Reserved | |
12 | 4 | Created | Date and time the archive was created, in DOS format. |
16 | 4 | Modified | Date and time the archive was last modified (added to the note in 1993). |
20 | 4 | Archive size | Used only by secured archives. |
24 | 4 | Security envelope position | File position of the ARJ-SECURITY envelope. |
28 | 2 | Filespec position | Where the file name part starts in the stored name. |
30 | 2 | Security envelope length | |
32 | 1 | Encryption version | “Not used” in ARJ 2.4x; later versions record the garbling method here. |
33 | 1 | Last chapter | Later versions: the highest chapter number in a chapter archive. “Not used” in ARJ 2.4x. |
34 | 1 | Protection factor | Later versions, when first_hdr_size ≥ 34: the ARJ-PROTECT recovery data factor. |
35 | 1 | Flags 2 | Later versions: second flags byte. |
36 | 2 | Spare | Later versions: unused. |
4 + first_hdr_size | … | Archive name | The archive’s file name when it was made, NUL-terminated. |
| … | … | Comment | Archive comment, NUL-terminated. |
ARJ-SECURITY, the authenticity envelope sold as an add-on, uses the fields at 9 and 20 to 31; their layout was made public with ARJ 2.39. The contents of the envelope itself are not public.
Main header flags
| Bit | ARJ 2.4x name | Meaning |
|---|---|---|
01 | not used | Later versions: GARBLED_FLAG, the archive is password-protected. |
02 | OLD_SECURED_FLAG | Secured with the old method. Later versions reuse the bit as ANSIPAGE_FLAG: names are in the Windows ANSI code page. |
04 | VOLUME_FLAG | Another volume follows. |
08 | not used | Later versions: ARJPROT_FLAG, the archive carries ARJ-PROTECT recovery data. |
10 | PATHSYM_FLAG | The archive name was translated: \ became /. |
20 | BACKUP_FLAG | A backup-type archive. |
40 | SECURED_FLAG | The archive has an ARJ-SECURITY envelope. |
80 | – | Later versions: ALTNAME_FLAG. Its exact meaning is not in any public description found. |
Local file header
first_hdr_size is 30, or 34 when EXTFILE_FLAG is set; later
versions write 46 to add the access and creation times.
| Offset | Size | Name | Description |
|---|---|---|---|
4 | 1 | first_hdr_size | As in the main header. |
5 | 1 | Archiver version | |
6 | 1 | Minimum version to extract | |
7 | 1 | Host OS | See host OS. |
8 | 1 | ARJ flags | See local header flags. |
9 | 1 | Method | See methods. |
10 | 1 | File type | See file types. |
11 | 1 | Reserved | Later versions: the password modifier, a value mixed into the garbling key. |
12 | 4 | Modified | Date and time the file was last modified, in DOS format. |
16 | 4 | Compressed size | Bytes of data after the header. |
20 | 4 | Original size | Size when extracted. For text-mode files this can differ from the size on disk, because line endings are converted. |
24 | 4 | Original CRC | CRC-32 of the extracted data. |
28 | 2 | Filespec position | Offset of the file name part in the stored path. |
30 | 2 | File access mode | File attributes or mode of the host system (DOS attributes on DOS, st_mode bits on Unix). |
32 | 1 | First chapter | “Host data, currently unused” in ARJ 2.4x. Later versions: the first chapter the file belongs to. |
33 | 1 | Last chapter | Later versions: the last chapter the file belongs to. |
34 | 4 | Extended file position | Only with EXTFILE_FLAG: where this part of a split file starts in the whole file. |
38 | 4 | Accessed | Later versions, when first_hdr_size ≥ 46: last access time, DOS format. |
42 | 4 | Created | As above: creation time. |
46 | 4 | Original size, all volumes | As above: the whole file’s size even when this part is one volume of it. |
4 + first_hdr_size | … | File name | Path and name, NUL-terminated. |
| … | … | Comment | File comment, NUL-terminated. |
The compressed data follows the frame’s last CRC (or the zero extended header size).
Local header flags
| Bit | Name | Meaning |
|---|---|---|
01 | GARBLED_FLAG | The file is password-protected (garbled). |
02 | not used | |
04 | VOLUME_FLAG | The file continues in the next volume. |
08 | EXTFILE_FLAG | This is a continued part: the extended file position field is present. |
10 | PATHSYM_FLAG | The name was translated: \ became /. |
20 | BACKUP_FLAG | The file is marked as a backup. |
40, 80 | – | Not defined in the note. |
Code values
Host OS
| Value | System |
|---|---|
0 | MS-DOS |
1 | PRIMOS |
2 | Unix |
3 | Amiga |
4 | Mac OS |
5 | OS/2 |
6 | Apple IIGS |
7 | Atari ST |
8 | NeXT |
9 | VAX VMS |
10 | Windows 95 (later versions) |
11 | Win32 (later versions) |
Methods
| Value | Method |
|---|---|
0 | Stored |
1 | Compressed, most (best compression) |
2 | Compressed |
3 | Compressed, faster |
4 | Compressed, fastest |
8 | No data, no CRC (later versions; used for entries such as chapter labels) |
9 | No data (later versions) |
Methods 1 to 3 are the same LZ77 and static Huffman scheme, the one UNARJ decodes, with a 26,624-byte window; they differ only in how hard the compressor searches. Method 4 is a simpler and faster scheme with no Huffman tables: match lengths and positions are written as variable-length bit codes. UNARJ’s source is the public description of both decoders.
File types
| Value | Type |
|---|---|
0 | Binary |
1 | 7-bit text (stored with line endings converted) |
2 | Main header (later versions also: comment header) |
3 | Directory |
4 | Volume label |
5 | Chapter label (later versions) |
Date and time
A 32-bit MS-DOS date and time, local time, with 2-second resolution:
| Bits | Meaning |
|---|---|
| 31 to 25 | Year − 1980 |
| 24 to 21 | Month, 1 to 12 |
| 20 to 16 | Day, 1 to 31 |
| 15 to 11 | Hour, 0 to 23 |
| 10 to 5 | Minute, 0 to 59 |
| 4 to 0 | Second ÷ 2 |
Finding the archive
A self-extracting ARJ is an MS-DOS program with the archive after it, and the main
header need not follow the program directly. The note’s find_header()
routine searches for it:
- Find the bytes
60 EA. - Read the next 2 bytes as the basic header size. If it is over 2,600, move one byte past the ID and search again.
- Read that many bytes and their CRC-32. If the CRC does not match, move one byte past the ID and search again.
The archive ends with a header whose basic header size is 0: the four
bytes 60 EA 00 00. Split archives continue in .a01,
.a02 and so on, each with its own main header.