unblob icon indicating copy to clipboard operation
unblob copied to clipboard

Add Support for Parity Archives (PAR/PAR2)

Open qkaiser opened this issue 9 months ago • 0 comments

Description
Parchive, commonly known as PAR (v1) or PAR2, is a format for creating redundant data that helps detect and repair corrupted files. These archives typically accompany split-file sets (like multi-volume RAR or ZIP archives).

References

How to Craft

  1. Install par2cmdline (e.g., sudo apt-get install par2 on Debian/Ubuntu).
  2. Create a PAR2 set with:
    par2 create test.par2 file_to_protect
    
  3. You can verify it with:
    par2 verify test.par2
    

Magic Value / Signature

  • PAR2: Often begins with PAR2\0PKT (i.e., PAR2 + 0x00 + PKT).
  • PAR (v1): Older .par files don’t have a well-defined signature but may contain identifiable metadata blocks.

How to Extract / Decompress

  • Tool: Use par2cmdline for verification and recovery.
  • Python Library: There’s no widely adopted Python library for PAR2 extraction. Typically, par2cmdline is used.

Determining End Offset

  • Each PAR2 file is composed of multiple “packets.” Each packet header includes a length field.
  • Summing the lengths of these packets gives the total file size.
  • In unblob, parse the packet structure to find where each one ends and the next begins.

qkaiser avatar Feb 11 '25 08:02 qkaiser