How unrar Handles CRC Checks Across Split Volumes

When extracting multi-part archives, unrar ensures data integrity by combining local volume-level verification with a continuous checksum calculation across volume boundaries. Rather than treating each volume's payload in isolation, the extraction utility validates the structural headers of each individual archive part while calculating a running checksum for the uncompressed file data as it streams across split boundaries. This multi-tiered approach allows unrar to detect corrupted headers immediately and catch payload corruption as soon as a reconstructed file finishes unpacking.

Volume and Block-Level Checksums

Every volume in a multi-part RAR set contains its own headers and structural metadata. Each header includes a distinct CRC32 (Cyclic Redundancy Check) value that covers the header data itself.

Before processing the compressed payload inside a volume, unrar reads the volume header, the file header, and any optional service headers. It validates each header against its embedded CRC. If disk corruption or an incomplete download alters the metadata of a specific part, unrar halts or warns the user immediately with a header CRC error before attempting to decompress payload data.

The Continuous File-Level Checksum

Files spanning across multiple volumes do not have separate file CRCs for each split chunk. Instead, the archive metadata stores a single checksum for the complete, unpacked file:

  • RAR4 Format: Stores a 32-bit CRC (CRC32) calculated over the entire original, uncompressed file.
  • RAR5 Format: Stores either a 32-bit CRC32 or a 256-bit BLAKE2sp cryptographic hash representing the entire uncompressed file.

Because the stored checksum represents the entire file, unrar initializes a running hash accumulator when decompression begins in the first volume containing that file.

Cross-Volume Processing

As unrar reads compressed blocks, it decompresses the data in memory and writes the resulting output stream to disk. Simultaneously, it feeds the decompressed bytes into its active CRC32 or BLAKE2 context.

When the decompressor reaches the end of a volume's data payload:

  1. State Preservation: The extraction process pauses data decompression but retains the decompression dictionary and the running CRC accumulator in memory.
  2. Next Volume Verification: unrar prompts for or opens the subsequent file (e.g., .part2.rar). It checks the volume header to confirm that the file is the correct sequential volume and matches the archive set ID.
  3. Resumption: Decompression resumes seamlessly, feeding the new volume's unpacked bytes into the preserved CRC state.

Final Verification and Error Handling

Once unrar reaches the terminal block of the file—marked by a flag indicating that the file does not continue into another volume—it finalizes the hash accumulator.

The computed hash is directly compared against the expected checksum recorded in the file header:

  • Match: The file is marked valid, and unrar proceeds to the next file or exits with a success code.
  • Mismatch: unrar generates a standard "CRC failed" error. By default, the corrupted extracted file is deleted unless the user specifies the -kb (keep broken extracted files) switch during execution.

If the archive includes recovery volumes (.rev) or recovery records, unrar (or rar) uses Reed-Solomon error correction codes to repair missing or corrupted volumes before the standard extraction and CRC verification take place.