unblob
unblob copied to clipboard
Add Support for Parity Archives (PAR/PAR2)
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
- Install
par2cmdline(e.g.,sudo apt-get install par2on Debian/Ubuntu). - Create a PAR2 set with:
par2 create test.par2 file_to_protect - 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
par2cmdlinefor verification and recovery. - Python Library: There’s no widely adopted Python library for PAR2 extraction. Typically,
par2cmdlineis 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.