1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
// Copyright 2024 Logan Magee
//
// SPDX-License-Identifier: MPL-2.0
//! 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:
//!
//! ```no_run
//! use std::fs::{self, File};
//!
//! # fn main() -> std::io::Result<()> {
//! 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)?;
//!
//! # Ok(())
//! # }
//! ```
//!
//! Applying a patch file to create an updated executable:
//!
//! ```no_run
//! use std::{io, fs::File};
//!
//! # fn main() -> Result<(), Box<dyn std::error::Error>> {
//! 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)?;
//!
//! # Ok(())
//! # }
//! ```
pub use ;
pub use ;