| HIGH_PACK_SIZE and HIGH_UNP_SIZE fields are present. These fields are used to archive only very large files (larger than 2Gb), for smaller files these fields are absent.

+

|-

+

| 200

+

| FILE_NAME contains both usual and encoded Unicode name separated by zero. In this case NAME_SIZE field is equal to the length of usual name plus encoded Unicode name plus 1. If this flag is present, but FILE_NAME does not contain zero bytes, it means that file name is encoded using UTF-8.

+

|-

+

| 400

+

| The header contains additional 8 bytes after the file name, which are required to increase encryption security (so called 'salt').

+

|-

+

| 800

+

| Version flag. It is an old file version, a version number is appended to file name as ';n'.

+

|-

+

| 1000

+

| Extended time field present.

+

|-

+

| 8000

+

| This bit always is set, so the complete block size is HEAD_SIZE + PACK_SIZE (and plus HIGH_PACK_SIZE, if bit 0x100 is set)

+

|}

+

+

{| class="wikitable"

+

|+Dictionary Bits

+

! Bits (7 6 5)

+

! Description

+

! Size (KB)

+

|-

+

| 0 0 0

+

| Dictionary Size

+

| 64

+

|-

+

| 0 0 1

+

| Dictionary Size

+

| 128

+

|-

+

| 0 1 0

+

| Dictionary Size

+

| 256

+

|-

+

| 0 1 1

+

| Dictionary Size

+

| 512

+

|-

+

| 1 0 0

+

| Dictionary Size

+

| 1024

+

|-

+

| 1 0 1

+

| Dictionary Size

+

| 2048

+

|-

+

| 1 1 0

+

| Dictionary Size

+

| 4096

+

|-

+

| 1 1 1

+

| file is a directory

+

| N/A

+

|}

+

+

{| class="wikitable"

+

|+ Operating System Indicators

+

! Byte Indicator

+

! Operating System

+

|-

+

| 0

+

| MS DOS

+

|-

+

| 1

+

| OS/2

+

|-

+

| 2

+

| Windows

+

|-

+

| 3

+

| Unix

+

|-

+

| 4

+

| Mac OS

+

|-

+

| 5

+

| BeOS

+

|}

+

----

Revision as of 20:03, 12 April 2012

RAR Archives (Roshal ARchive file format) is a proprietary format for storing information created by Eugene Roshal. The format is currently handled by Alexander Roshal, Eugene's brother.

Archive Header (MAIN_HEAD)

Bit Flags (Please see 'Bit Flags for MAIN_HEAD' table for all possibilities).

HEAD_SIZE

2

Archive header total size including archive comments

RESERVED1

2

RESERVED

RESERVED2

4

RESERVED

Bit Flags for MAIN_HEAD

Flag (0x)

Description

0001

Volume attribute (archive volume)

0002

Archive comment present RAR 3.x uses the separate comment block and does not set this flag.

0004

Archive lock attribute

0008

Solid attribute (solid archive)

0010

New volume naming scheme ('volname.partN.rar')

0020

Authenticity information present RAR 3.x does not set this flag.

0040

Recovery record present

0080

Block headers are encrypted

0100

First volume (set only by RAR 3.0 and later)

Other bits in HEAD_FLAGS are reserved for internal use.

File Header (File in Archive)

File Header

Field Name

Size (bytes)

Description

HEAD_CRC

2

CRC of fields from HEAD_TYPE to FILEATTR and file name

HEAD_TYPE

1

Header Type: 0x74

HEAD_FLAGS

2

Bit Flags (Please see 'Bit Flags for File in Archive' table for all possibilities)

HEAD_SIZE

2

File header full size including file name and comments

PACK_SIZE

4

Compressed file size

UNP_SIZE

4

Uncompressed file size

HOST_OS

1

Operating system used for archiving (See the 'Operating System Indicators' table for the flags used)

FILE_CRC

4

File CRC

FTIME

4

Date and time in standard MS DOS format

UNP_VER

1

RAR version needed to extract file (Version number is encoded as 10 * Major version + minor version.)

METHOD

1

Packing method (Please see 'Packing Method' table for all possibilities

NAME_SIZE

2

File name size

ATTR

4

File attributes

HIGH_PACK_SIZE

4

High 4 bytes of 64-bit value of compressed file size. Optional value, presents only if bit 0x100 in HEAD_FLAGS is set.

HIGH_UNP_SIZE

4

High 4 bytes of 64-bit value of uncompressed file size. Optional value, presents only if bit 0x100 in HEAD_FLAGS is set.

FILE)NAME

NAME_SIZE bytes

File name - string of NAME_SIZE bytes size

SALT

8

present if (HEAD_FLAGS & 0x400) != 0

EXT_TIME

variable size

present if (HEAD_FLAGS & 0x1000) != 0

other new fields may appear here.

Bit Flags for Files in Archive

Flag (0x)

Description

01

File continued from previous volume

02

File continued in next volume

04

File encrypted with password

08

File comment present. RAR 3.x uses the separate comment block and does not set this flag.

10

Information from previous files is used (solid flag) (for RAR 2.0 and later)

Dictionary bits 7 6 5 (for RAR 2.0 and later)

Please see the 'Dictionary Bits' table for this descriptions

100

HIGH_PACK_SIZE and HIGH_UNP_SIZE fields are present. These fields are used to archive only very large files (larger than 2Gb), for smaller files these fields are absent.

200

FILE_NAME contains both usual and encoded Unicode name separated by zero. In this case NAME_SIZE field is equal to the length of usual name plus encoded Unicode name plus 1. If this flag is present, but FILE_NAME does not contain zero bytes, it means that file name is encoded using UTF-8.

400

The header contains additional 8 bytes after the file name, which are required to increase encryption security (so called 'salt').

800

Version flag. It is an old file version, a version number is appended to file name as ';n'.

1000

Extended time field present.

8000

This bit always is set, so the complete block size is HEAD_SIZE + PACK_SIZE (and plus HIGH_PACK_SIZE, if bit 0x100 is set)

Dictionary Bits

Bits (7 6 5)

Description

Size (KB)

0 0 0

Dictionary Size

64

0 0 1

Dictionary Size

128

0 1 0

Dictionary Size

256

0 1 1

Dictionary Size

512

1 0 0

Dictionary Size

1024

1 0 1

Dictionary Size

2048

1 1 0

Dictionary Size

4096

1 1 1

file is a directory

N/A

Operating System Indicators

Byte Indicator

Operating System

0

MS DOS

1

OS/2

2

Windows

3

Unix

4

Mac OS

5

BeOS

Metadata

Sub-formats

The RAR format is comprised of many sub-formats that have changed over the years. The different formats and their descriptions are as follows:

1.3 (Does not have the RAR! signature)

There is difficulty finding information regarding this sub-format. Please update if you know something.

1.5

Utilizes a proprietary compression method that is not available to the public.