multidiff-rs

Crates.iomultidiff-rs
lib.rsmultidiff-rs
version0.0.1
created_at2025-12-09 18:26:50.741209+00
updated_at2025-12-09 18:26:50.741209+00
descriptionBinary data diffing for multiple objects or streams of data
homepagehttps://github.com/mtxr/multidiff-rs
repositoryhttps://github.com/mtxr/multidiff-rs
max_upload_size
id1975929
size69,111
Matheus Teixeira (mtxr)

documentation

https://github.com/mtxr/multidiff-rs

README

Multidiff-rs

A sensory augmentation apparatus for binary data analysis

About

Multidiff makes machine-friendly data easier to understand for humans. It helps visualize differences within large sets of objects by performing smart diffs and displaying them in a sensible manner. This is particularly useful for finding patterns and structure in proprietary protocols or unusual file formats.

Use cases: Reverse engineering, binary data analysis, packet inspection, file format analysis.

Inspired by the original Python multidiff by Juha Kivekäs.

Installation

Quick Install

From crates.io (recommended):

cargo install multidiff

From source:

cargo install --path .

Package Managers

macOS

Homebrew:

brew tap mtxr/multidiff-rs
brew install multidiff

Linux

Debian/Ubuntu (.deb package):

# Download and install
curl -LO https://github.com/mtxr/multidiff-rs/releases/download/v0.1.0/multidiff_0.1.0_amd64.deb
sudo dpkg -i multidiff_0.1.0_amd64.deb

Arch Linux (AUR):

# Using yay
yay -S multidiff

# Using paru
paru -S multidiff

# Manual installation
git clone https://aur.archlinux.org/multidiff.git
cd multidiff
makepkg -si

Fedora/RHEL/CentOS (.rpm package):

# Download and install
curl -LO https://github.com/mtxr/multidiff-rs/releases/download/v0.1.0/multidiff-0.1.0-1.x86_64.rpm
sudo rpm -i multidiff-0.1.0-1.x86_64.rpm

# Or using dnf
sudo dnf install multidiff-0.1.0-1.x86_64.rpm

Universal Linux (shell script installer):

curl --proto '=https' --tlsv1.2 -LsSf https://github.com/mtxr/multidiff-rs/releases/download/v0.1.0/multidiff-installer.sh | sh

Windows

Winget (recommended):

winget install mtxr.Multidiff

PowerShell installer:

irm https://github.com/mtxr/multidiff-rs/releases/download/v0.1.0/multidiff-installer.ps1 | iex

Chocolatey:

choco install multidiff

Scoop:

scoop bucket add mtxr https://github.com/mtxr/scoop-bucket
scoop install multidiff

Pre-built Binaries

Download pre-built binaries for your platform from GitHub Releases.

Available platforms:

  • Linux x86_64 (glibc and musl)
  • Linux aarch64
  • macOS x86_64 (Intel)
  • macOS aarch64 (Apple Silicon)
  • Windows x86_64

Manual installation (Linux/macOS):

# Linux x86_64 (musl - statically linked, works on any Linux)
curl -L https://github.com/mtxr/multidiff-rs/releases/download/v0.1.0/multidiff-v0.1.0-x86_64-unknown-linux-musl.tar.gz | tar xz
sudo mv multidiff /usr/local/bin/

# macOS Intel
curl -L https://github.com/mtxr/multidiff-rs/releases/download/v0.1.0/multidiff-v0.1.0-x86_64-apple-darwin.tar.gz | tar xz
sudo mv multidiff /usr/local/bin/

# macOS Apple Silicon
curl -L https://github.com/mtxr/multidiff-rs/releases/download/v0.1.0/multidiff-v0.1.0-aarch64-apple-darwin.tar.gz | tar xz
sudo mv multidiff /usr/local/bin/

Manual installation (Windows - PowerShell):

Invoke-WebRequest -Uri "https://github.com/mtxr/multidiff-rs/releases/download/v0.1.0/multidiff-v0.1.0-x86_64-pc-windows-msvc.zip" -OutFile multidiff.zip
Expand-Archive multidiff.zip
Move-Item multidiff\multidiff.exe C:\Windows\System32\

Building from Source

Requires Rust 1.79.0 or newer:

git clone https://github.com/mtxr/multidiff-rs
cd multidiff
cargo build --release
sudo mv target/release/multidiff /usr/local/bin/

Or build and install in one step:

cargo install --git https://github.com/mtxr/multidiff-rs

Quick Start

# Compare shell history for repetitions
history | multidiff -s -o utf8

# Diff multiple files
multidiff file1.bin file2.bin folder/ | less -r

# Start a diff server
multidiff -p 8000

# Send data to server (in another terminal)
echo "interesting" | nc 127.0.0.1 8000
echo "intersectional" | nc 127.0.0.1 8000

Usage

multidiff [OPTIONS] [FILES]...

Arguments:
  [FILES]...  Files or directories to diff

Options:
  -p, --port <PORT>            Start TCP server on port
  -s, --stdin                  Read from stdin (line-by-line)
  -m, --mode <MODE>            Diff mode: sequence|baseline [default: sequence]
  -i, --informat <FORMAT>      Input format: utf8|raw|hex|json
  -o, --outformat <FORMAT>     Output format: hexdump|hex|utf8 [default: hexdump]
      --html                   Use HTML colors instead of ANSI
  -h, --help                   Print help

Features

Input Formats

  • raw - Binary files (default for files)
  • utf8 - Text data (default for stdin)
  • hex - Hexadecimal strings
  • json - JSON objects with base64 data

Output Formats

  • hexdump - Colorized hexdump view (default)
  • hex - Plain hex output
  • utf8 - Text output

Diff Modes

  • sequence - Diff each object with the previous one
  • baseline - Diff all objects against the first one

Colors

  • ANSI - Terminal colors (default)
  • HTML - HTML span tags for web display

Server Mode

The TCP server accepts raw bytes or JSON objects:

{
  "data": "[base64 encoded data]",
  "info": "optional metadata"
}

Example provider in examples/zap_websocket_multidiff_provider.js

Building from Source

cargo build --release
./target/release/multidiff --help

Dependencies

  • clap - CLI parsing
  • difflib - Rust port of Python's difflib
  • tokio - Async runtime for TCP server
  • serde/serde_json - JSON support
  • base64 - Base64 encoding
  • hex - Hex encoding
  • regex - Pattern matching

Performance

Multidiff is built with Rust for:

  • Fast startup (~2ms vs ~80ms Python)
  • Efficient memory usage
  • Safe concurrency
  • Single binary distribution

License

MIT

Author

Matheus Teixeira

Inspired by the original Python multidiff by Juha Kivekäs.

Commit count: 0

cargo fmt