par2-rs
PAR2 verification and repair in pure Rust. No C bindings, no external par2
binary.
[]
= "0.4"
Usage
use ;
let packets = scan_packets_from_path?
.into_iter
.map
.collect;
let set = from_packets?;
let access = new;
let result = verify_all;
println!;
Par2Repairer drives the full sequence: scan, verify, solve, repair, verify
again.
Capabilities
- All PAR2 packet types: Main, File Description, IFSC, Recovery Slice, Creator.
- Packets from any number of
.par2files aggregate into one set. - Slice-level verification from IFSC CRC32 + MD5 pairs, so damage is localised rather than condemning a whole file.
- 16 KB quick-check for cheap file identification; full-file MD5 for sets with no IFSC data.
- Placement-aware repair: renamed and moved files are matched by content.
- Malformed or truncated packets are skipped by scanning forward, rather than failing the set.
Verifying data that is not on disk
verify_all reads through the FileAccess trait. DiskFileAccess is the
ordinary implementation, but supplying your own allows verification against
bytes that are still arriving over a network, or that are assembled from a
source with no file paths at all.
Performance
2.0× means rarpar finished in half the time:
| CPU | Arch | Instruction set | par2 (heavy) |
|---|---|---|---|
| AMD EPYC 9R14 (Zen 4) | x86-64 | GFNI + AVX-512 | 2.3× |
| Intel Xeon Platinum 8488C (Sapphire Rapids) | x86-64 | GFNI + AVX-512 | 1.9× |
| Intel Core i5-1240P (Alder Lake) | x86-64 | GFNI + AVX2 | 2.3× |
| Intel Xeon Platinum 8124M (Skylake-SP) | x86-64 | AVX-512 | 1.8× |
| AMD Ryzen 5 3600 (Zen 2) | x86-64 | AVX2 | 1.6× |
| Intel Xeon E5-2666 v3 (Haswell) | x86-64 | AVX2 | 1.9× |
| Intel Atom C3538 (Denverton) | x86-64 | SSSE3 (no AVX) | 1.4× |
| Apple M5 Max | arm64 | NEON | 7.2× |
| Arm Cortex-A72 | arm64 | NEON | 1.2× |
| Arm Neoverse N1 | arm64 | NEON | 1.5× |
| Arm Neoverse V2 | arm64 | NEON | 1.5× |
Per-case charts for every machine, the full methodology, and the versions these numbers were measured with: rarpar benchmarks.
Provenance
This is an independent Rust implementation, heavily informed by par2cmdline-turbo, Anime Tosho's speed-focused fork of par2cmdline. Both are GPL-2.0-or-later. That work is also the benchmark reference this crate is measured against.
The PAR2 format itself is specified in the Parity Volume Set Specification 2.0.
Versioned API and migration notes are in CHANGELOG.md.
License
GPL-3.0-or-later. See LICENSE.