Expand description
Pure Rust PAR2 verify and repair.
The first Rust crate with full PAR2 repair support. Implements GF(2^16)
arithmetic with the PAR2-mandated polynomial 0x1100B and Reed-Solomon
decoding for block-level repair.
§Usage
use std::path::Path;
let par2_path = Path::new("/downloads/movie/movie.par2");
let job_dir = Path::new("/downloads/movie");
// Parse the PAR2 index file
let file_set = rust_par2::parse(par2_path).unwrap();
// Verify all files
let result = rust_par2::verify(&file_set, job_dir);
if result.all_correct() {
println!("All files intact");
} else if result.repair_possible {
// Repair damaged/missing files
let repair = rust_par2::repair(&file_set, job_dir).unwrap();
println!("{repair}");
}Re-exports§
pub use repair::RepairError;pub use repair::RepairResult;pub use repair::repair;pub use repair::repair_from_verify;pub use repair::repair_from_verify_no_reverify;pub use types::DamagedFile;pub use types::Md5Hash;pub use types::MissingFile;pub use types::Par2File;pub use types::Par2FileSet;pub use types::SliceChecksum;pub use types::VerifiedFile;pub use types::VerifyResult;
Modules§
- gf
- GF(2^16) Galois field arithmetic.
- gf_simd
- SIMD-accelerated GF(2^16) buffer operations.
- gf_
simd_ public - Re-export SIMD functions for benchmarks.
- matrix
- Matrix operations over GF(2^16) for Reed-Solomon decoding.
- recovery
- Recovery block reading from PAR2 volume files.
- repair
- PAR2 repair engine.
- types
- Data types for PAR2 file sets.
Enums§
- Parse
Error - Errors that can occur while parsing PAR2 files.
Functions§
- compute_
hash_ 16k - Compute the MD5 hash of the first 16 KiB of a file.
- parse
- Parse a PAR2 file and return the complete file set metadata.
- parse_
par2_ reader - Parse PAR2 packets from any
Read + Seeksource. - verify
- Verify all files in a PAR2 set against actual files in a directory.