home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 9 Archive / 09-Archive.zip / unar2412.zip / technote.doc < prev    next >
Text File  |  1993-06-23  |  9KB  |  221 lines

  1.  
  2.      ARJ TECHNICAL INFORMATION                               April 1993
  3.  
  4.  
  5.      ** IMPORTANT NEWS ****************************************************
  6.  
  7.      Some archiver support programs have incorporated ARJ archive
  8.      identification schemes that are not reliable.  At ARJ 2.39 and above,
  9.      there are now two versions of the large self-extraction module.  The
  10.      17K byte ARJSFX module supports ARJ-SECURITY.  The standard 15K byte
  11.      ARJSFX module does NOT support ARJ-SECURITY.  For the first time, the
  12.      ARJ-SECURITY fields in the main ARJ header are publicly defined.
  13.  
  14.      ARJ has used the same ARJ archive identification scheme since ARJ
  15.      1.0.  The following is the algorithm:
  16.  
  17.      (1) find the ARJ header id bytes 0x60, 0xEA,
  18.      (2) read the next two bytes as the header record size in bytes,
  19.      (3) if the record size is greater than 2600, go back to the header
  20.          id file position, increment the file position, and go back to
  21.          step (1),
  22.      (4) read the header record based upon the previous byte count,
  23.      (5) calculate the 32 bit CRC of the header record data,
  24.      (6) read the next four bytes as the actual header record CRC,
  25.      (7) if the actual CRC does not equal the calculated CRC, go back
  26.          to the header id file position, increment the file position,
  27.          and go back to step (1).
  28.  
  29.      This algorithm is fully demonstrated in the UNARJ C source code.
  30.  
  31.      When using listfiles with ARJ, ARJ support programs should use the
  32.      "-p" option to ensure that ARJ will only extract the selected files
  33.      from an ARJ archive.  This is important for ARJ archives that have
  34.      pathname information stored.
  35.  
  36.      There is an extended header bug in older versions of ARJ, AV.C and
  37.      UNARJ.C.  The extended header processing in read_header() should
  38.      skip 4 bytes for the extended header CRC and not 2.  This is NOT a
  39.      current problem as no versions of ARJ use the extended header.
  40.  
  41.      **********************************************************************
  42.  
  43.  
  44.      Modification history:
  45.      Date      Description of modification:
  46.      --------  ------------------------------------------------------------
  47.      02/17/93  Added description of ARJ security fields.
  48.                Added archive date-modified field.
  49.      12/03/91  Added BACKUP flag to header arj flags.
  50.      11/21/91  Described the two types of headers separately.
  51.      11/11/91  Added information about the change in text mode processing.
  52.      06/28/91  Added several new HOST OS numbers.
  53.      05/19/91  Improved the description of extended header processing.
  54.      05/11/91  Simplified this document.  Added volume label type.
  55.      03/11/91  Added directory file type.
  56.      02/23/91  Added more comments.
  57.      01/10/91  Corrected timestamp description and header order of file mode.
  58.      10/30/90  Corrected values of flags in ARJ flags.
  59.  
  60.  
  61.      ARJ archives contains two types of header blocks:
  62.  
  63.     Archive main header - This is located at the head of the archive
  64.     Local file header   - This is located before each archived file
  65.  
  66.      Structure of main header (low order byte first):
  67.  
  68.      Bytes Description
  69.      ----- -------------------------------------------------------------------
  70.        2   header id (main and local file) = 0x60 0xEA
  71.        2   basic header size (from 'first_hdr_size' thru 'comment' below)
  72.          = first_hdr_size + strlen(filename) + 1 + strlen(comment) + 1
  73.          = 0 if end of archive
  74.                  maximum header size is 2600
  75.  
  76.        1   first_hdr_size (size up to and including 'extra data')
  77.        1   archiver version number
  78.        1   minimum archiver version to extract
  79.        1   host OS   (0 = MSDOS, 1 = PRIMOS, 2 = UNIX, 3 = AMIGA, 4 = MAC-OS)
  80.              (5 = OS/2, 6 = APPLE GS, 7 = ATARI ST, 8 = NEXT)
  81.              (9 = VAX VMS)
  82.        1   arj flags
  83.              (0x01 = NOT USED)
  84.                      (0x02 = OLD_SECURED_FLAG)
  85.              (0x04 = VOLUME_FLAG)  indicates presence of succeeding
  86.                        volume
  87.              (0x08 = NOT USED)
  88.              (0x10 = PATHSYM_FLAG) indicates archive name translated
  89.                        ("\" changed to "/")
  90.              (0x20 = BACKUP_FLAG) indicates backup type archive
  91.                      (0x40 = SECURED_FLAG)
  92.        1   security version (2 = current)
  93.        1   file type        (must equal 2)
  94.        1   reserved
  95.        4   date time when original archive was created
  96.        4   date time when archive was last modified
  97.        4   archive size (currently used only for secured archives)
  98.        4   security envelope file position
  99.        2   filespec position in filename
  100.        2   length in bytes of security envelope data
  101.        2   (currently not used)
  102.        ?   (currently none)
  103.  
  104.        ?   filename of archive when created (null-terminated string)
  105.        ?   archive comment  (null-terminated string)
  106.  
  107.        4   basic header CRC
  108.  
  109.        2   1st extended header size (0 if none)
  110.        ?   1st extended header (currently not used)
  111.        4   1st extended header's CRC (not present when 0 extended header size)
  112.  
  113.  
  114.      Structure of local file header (low order byte first):
  115.  
  116.      Bytes Description
  117.      ----- -------------------------------------------------------------------
  118.        2   header id (main and local file) = 0x60 0xEA
  119.        2   basic header size (from 'first_hdr_size' thru 'comment' below)
  120.          = first_hdr_size + strlen(filename) + 1 + strlen(comment) + 1
  121.          = 0 if end of archive
  122.                  maximum header size is 2600
  123.  
  124.        1   first_hdr_size (size up to and including 'extra data')
  125.        1   archiver version number
  126.        1   minimum archiver version to extract
  127.        1   host OS   (0 = MSDOS, 1 = PRIMOS, 2 = UNIX, 3 = AMIGA, 4 = MAC-OS)
  128.              (5 = OS/2, 6 = APPLE GS, 7 = ATARI ST, 8 = NEXT)
  129.              (9 = VAX VMS)
  130.        1   arj flags (0x01 = GARBLED_FLAG) indicates passworded file
  131.                      (0x02 = NOT USED)
  132.              (0x04 = VOLUME_FLAG)  indicates continued file to next
  133.                        volume (file is split)
  134.              (0x08 = EXTFILE_FLAG) indicates file starting position
  135.                        field (for split files)
  136.              (0x10 = PATHSYM_FLAG) indicates filename translated
  137.                        ("\" changed to "/")
  138.              (0x20 = BACKUP_FLAG)  indicates file marked as backup
  139.        1   method    (0 = stored, 1 = compressed most ... 4 compressed fastest)
  140.        1   file type (0 = binary,    1 = 7-bit text)
  141.              (3 = directory, 4 = volume label)
  142.        1   reserved
  143.        4   date time modified
  144.        4   compressed size
  145.        4   original size (this will be different for text mode compression)
  146.        4   original file's CRC
  147.        2   filespec position in filename
  148.        2   file access mode
  149.        2   host data (currently not used)
  150.        ?   extra data
  151.        4 bytes for extended file starting position when used
  152.            (these bytes are present when EXTFILE_FLAG is set).
  153.            0 bytes otherwise.
  154.  
  155.        ?   filename (null-terminated string)
  156.        ?   comment  (null-terminated string)
  157.  
  158.        4   basic header CRC
  159.  
  160.        2   1st extended header size (0 if none)
  161.        ?   1st extended header (currently not used)
  162.        4   1st extended header's CRC (not present when 0 extended header size)
  163.  
  164.        ...
  165.  
  166.        ?   compressed file
  167.  
  168.  
  169.      Time stamp format:
  170.  
  171.         31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
  172.        |<---- year-1980 --->|<- month ->|<--- day ---->|
  173.  
  174.     15 14 13 12 11 10  9  8  7  6  5  4  3    2  1  0
  175.        |<--- hour --->|<---- minute --->|<- second/2 ->|
  176.  
  177.  
  178.  
  179.      Compression methods:
  180.  
  181.      ARJ methods 1 to 3 use Lempel-Ziv 77 sliding window with static Huffman
  182.      encoding.
  183.  
  184.      ARJ method 4 uses Lempel-Ziv 77 sliding window with pointer/length
  185.      unary encoding.
  186.  
  187.      There is one decoder for methods 1 to 3 and one decoder for method 4.
  188.  
  189.  
  190.  
  191.      Encryption technology:
  192.  
  193.      ARJ does NOT use DES encryption algorithms.  It uses a combination of
  194.      simple exclusive-or operations.
  195.  
  196.  
  197.  
  198.      Security Envelope technology:
  199.  
  200.      ARJ at 2.39 and above uses a new security envelope mechanism.  To
  201.      defend against brute force attacks on the envelope data, the new
  202.      mechanism uses a 256 bit checksum and takes considerable time to
  203.      "checksum" the entire contents of a secured archive.  This checksum
  204.      is completely unrelated to any ARJ header fields.  The checksum
  205.      data is appended to the ARJ archive after the end of archive marker.
  206.      Deleting this checksum data will invalidate the security envelope.
  207.  
  208.  
  209.  
  210.      Text mode processing:
  211.  
  212.      As of ARJ 2.30 and UNARJ 2.30, files archived with the -t1 option
  213.      will not have the 8th bit stripped unless the file is extracted to
  214.      a different platform than the original one.  Therefore, it is now
  215.      possible to use ARJ to compress 8-bit text files in text mode and
  216.      extract them back in 8-bit mode.
  217.  
  218.  
  219.  
  220.      end of document
  221.