
ARC/PAK
-------

        ARC file header structure

        Byte number      Value(s)        Meaning
        --------------------------------------------------------------
        0                $1A             Header Flag
        1                0-9             Compression method
        2-14             ---             Filename.
        15-18            ---             Compressed file size.
        19-20            bits            Date format
                         15-9            Year
                          8-5            Month
                          4-0            Day
        21-22            bits            Time format
                         15-11           Hours (military)
                         10-5            Minutes
                          4-0            Seconds
        23-24            ---             CRC-16
        25-28            ---             Original file size

        Compression method
        ------------------
        1    unpacked (obsolete)
        2    unpacked
        3    packed
        4    squeezed (after packing)
        5    crunched (obsolete)
        6    crunched (after packing) (obsolete)
        7    crunched (after packing, using faster hash algorithm)
        8    crunched (after packing, using dynamic LZW variations)
        9    Squashed c/o Phil Katz (no packing) (var. on crunching)
        10   crushed (PAK only)
        11   distilled (PAK only)

        NOTE:    LZW is Lempel-Ziv-Welch compression algorithm



LZH
---
        LZH file header structure

        Byte number      Value(s)        Meaning
        --------------------------------------------------------------
        0                ---             Header size
        1                ---             Cksum of remaining bytes
        2-6              ---             Method
        7-10             ---             Compressed size
        11-14            ---             Uncompressed size
        15-16            ---             Time format
        17-18            ---             Date format
        19-20            ---             File attribute
        21-22            ---             Filename/path length
        23-XX            ---             Filename/path
        XX+1-XX+2        ---             CRC-16

        Compression method
        ------------------
        -lh0-   No compression used
        -lh1-   LZW, 4K buffer, Huffman for upper 6 bits of pos
        -lz4-   LZW, Arithmetic Encoding
        -lz5-   LZW, Arithmetic Encoding


ZIP
---
        ZIP file header structures

        Local File Header
        -----------------
        Byte number      Value(s)        Meaning
        --------------------------------------------------------------
        0-3              $04034B50       Local File Header Signature
        4-5              ---             Version needed to extract
        6-7              ---             General purpose bit flag
        8-9              0-6             Compression method
        10-11            ---             Time
        12-13            ---             Date
        14-17            ---             CRC-32
        18-21            ---             Compressed size
        22-25            ---             Uncompressed size
        26-27            ---             Filename length
        28-29            ---             Extra field length
        30-XX            ---             path/filename
        XX+1-YY          ---             extra field

        Central Directory Structure
        ---------------------------
        Byte number      Value(s)        Meaning
        --------------------------------------------------------------
        0-3              $02014B50       Central file header signature
        4                ---             Version made by
        5                ---             Host operating system
        6                ---             Version needed to extract
        7                ---             O/S of version needed for extraction
        8-9              ---             General purpose bit flag
        10-11            0-6             Compression method
        12-13            ---             Time
        14-15            ---             Date
        16-19            ---             CRC-32
        20-23            ---             Compressed size
        24-27            ---             Uncompressed size
        28-29            ---             Filename length
        30-31            ---             Extra field length
        32-33            ---             File comment length
        34-35            ---             Disk number start
        36-37            bit             Internal file attributes
                         0               if = 1, file is apparently an ASCII
                                         or text file
                         0               if = 0, file apparently contains
                                         binary data
                         1-7             unused in version 1.0.
        38-41            ---             External file attributes, host
                                         system dependent
        42-45            ---             Relative offset of local header
                                         from the start of the first disk
                                         on which this file appears
        46-XX            ---             Filename or path - should not
                                         contain a drive or device letter,
                                         or a leading slash. All slashes
                                         should be forward slashes '/'
        XX+1-YY          ---             extra field
        YY+1-ZZ          ---             file comment

        End of Central Directory Structure
        ----------------------------------
        Byte number      Value(s)        Meaning
        --------------------------------------------------------------
        0-3              $06064B50       End of central dir signature
        4-5              ---             Number of this disk
        6-7              ---             Number of disk with start central dir
        8-9              ---             Total number of entries in central dir
                                         on this disk
        10-11            ---             total number entries in central dir
        12-15            ---             Size of the central directory
        16-19            ---             Offset of start of central directory
                                         with respect to the starting disk
                                         number
        20-21            ---             zipfile comment length
        22-XX            ---             zipfile comment

        ZIP Values
        ----------

        Host O/S

        Value Description                Value Description
        ----- -------------------------- ----- ------------------------
        0      MS-DOS and OS/2 (FAT)     5      Atari ST
        1      Amiga                     6      OS/2 1.2 extended file sys
        2      VMS                       7      Macintosh
        3      *nix                      8 thru
        4      VM/CMS                    255    unused

        General Purpose Bit Flag

        Bit       Description
        --------- -----------------------------------------
        0       If set, file is encrypted
        1       If file Imploded and this bit is set, 8K
                sliding dictionary was used. If clear, 4K
                sliding dictionary was used.
        2       If file Imploded and this bit is set, 3
                Shannon-Fano trees were used. If clear, 2
                Shannon-Fano trees were used.
        3-4     unused
        5-7     used internally by ZIP

       Note:  Bits 1 and 2 are undefined if the compression method is
              other than type 6 (Imploding).

       Compression Method

       Name        Method Description
       ----------- ------ --------------------------------------------
       Stored         0    No compression
       Shrunk         1    LZW, 8K buffer, 9-13 bits with partial clearing
       Reduced-1      2    Probalistic compression, lower 7 bits
       Reduced-2      3    Probalistic compression, lower 6 bits
       Reduced-3      4    Probalistic compression, lower 5 bits
       Reduced-4      5    Probalistic compression, lower 4 bits
       Imploded       6    2/3 Shanno-Fano trees, 4K/8K sliding dictionary


ZOO
---
        ZOO file header structures

        Master Header
        -------------
        Byte number      Value(s)        Meaning
        --------------------------------------------------------------
        0-19             ---             Archive header text
        20-23            $FDC4A7DC       File signature
        24-27            ---             pointer to 1st header
        28-31            ---             pointer to 1st header - 1
        32               ---             version making archive
        33               ---             minimum version needed to extract

        File Header
        -----------
        Byte number      Value(s)        Meaning
        --------------------------------------------------------------
        0-3              $FDC4A7DC       signature
        4                ---             type of directory entry
        5                0-1             Compression method
        6-9              ---             position of next dir entry
        10-13            ---             position of header
        14-15            ---             Date
        16-17            ---             Time
        18-19            ---             CRC-16
        20-23            ---             Uncompressed size
        24-27            ---             Compressed size
        28               ---             version that made this file
        29               ---             minimum version needed to extract
        30               0-1             1 if file deleted from archive
        31-34            ---             pointer to comment, 0 if none
        35-36            ---             length of comment
        37-XX            ---             path/filename

        Compression Method

        NAME        DESCRIPTION
        ----------- --------------------------------------------
        Stored      No compression used
        Crunched    Packing, LZW, 4K buffer, var len (9-13 bits)


ARJ
---
     ARJ archives contains two types of header blocks:

  Archive main header - This is located at the head of the archive
  Local file header   - This is located before each archived file

     Structure of archive block (low order byte first):

     Bytes Description
     ----- -------------------------------------------------------------------
       2   header id (main and local file) = 0xEA60 or 60000U
       2   basic header size (from 'first_hdr_size' thru 'comment' below)
    = first_hdr_size + strlen(filename) + 1 + strlen(comment) + 1
    = 0 if end of archive

       1   first_hdr_size (size up to and including 'extra data')
       1   archiver version number
       1   minimum archiver version to extract
       1   host OS   (0 = MSDOS, 1 = PRIMOS, 2 = UNIX, 3 = AMIGA, 4 = MAC-OS)
        (5 = OS/2, 6 = APPLE GS, 7 = ATARI ST, 8 = NEXT)
        (9 = VAX VMS)
       1   arj flags (0x01 = GARBLED_FLAG) indicates passworded file
        (0x02 = RESERVED)
        (0x04 = VOLUME_FLAG)  indicates continued file to next
             volume
        (0x08 = EXTFILE_FLAG) indicates file starting position
             field
        (0x10 = PATHSYM_FLAG) indicates path translated
             ("\" changed to "/")
       1   method    (0 = stored, 1 = compressed most ... 4 compressed fastest)
       1   file type (0 = binary, 1 = 7-bit text, 2 = comment header)
        (3 = directory, 4 = volume label)
       1   reserved
       4   date time modified
       4   compressed size
       4   original size (this will be different for text mode compression)
       4   original file's CRC
       2   filespec position in filename
       2   file access mode
       2   host data (currently not used)
       ?   extra data
     4 bytes for extended file starting position when used
     (this is present when EXTFILE_FLAG is set)

       ?   filename (null-terminated string)
       ?   comment  (null-terminated string)

       4   basic header CRC

       2   1st extended header size (0 if none)
       ?   1st extended header (currently not used)
       4   1st extended header's CRC (not present when 0 extended header size)

       ...

       ?   compressed file


     Time stamp format:

  31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
       |<---- year-1980 --->|<- month ->|<--- day ---->|

  15 14 13 12 11 10  9  8  7  6  5  4  3  2  1  0
       |<--- hour --->|<---- minute --->|<- second/2 ->|



     Compression methods:


     ARJ methods 1 to 3 use Lempel-Ziv 77 sliding window with static Huffman
     encoding.

     ARJ method 4 uses Lempel-Ziv 77 sliding window with pointer/length
     unary encoding.

     There is one decoder for methods 1 to 3 and one decoder for method 4.
