Expand description
Binary diffing and patching designed for executables.
This crate provides simple interfaces for creating binary deltas between arbitrary blobs and applying them to reconstruct the original blob. It is especially well-suited for executable files, i.e., it is designed to produce small deltas specifically for executables.
§Examples
Creating a patch file between two executable versions:
use std::fs::{self, File};
let mut old = fs::read("app-v1.exe")?;
// Ensure the last byte is a 0
old.push(0);
let new = fs::read("app-v2.exe")?;
let mut patch = File::create("app-v1-to-v2.ina")?;
ina::diff(&old, &new, &mut patch)?;
Applying a patch file to create an updated executable:
use std::{io, fs::File};
let old = File::open("app-v1.exe")?;
let patch = File::open("app-v1-to-v2.ina")?;
let mut new = File::create("app-v2.exe")?;
ina::patch(old, patch, &mut new)?;
Structs§
- Diff
Config - Configuration for a diff operation.
- Patch
Metadata - Metadata of a patch file.
- Patch
Version - Version of a patch file format.
- Patcher
- A patcher that reconstructs a new blob from an old blob and a patch
Enums§
- Patch
Error - An error indicating that patching a blob failed.
Functions§
- diff
- Constructs a patch between two blobs with default options
- diff_
with_ config - Constructs a patch between two blobs
- patch
- Reconstructs a new blob from an old blob and a patch
- read_
header - Reads the header of
patchto extract its metadata.