u/ItzAlphabet

▲ 17 r/CLI

fasthex - a hex dumper that's actually fast: 55x over xxd, 140x faster than hexdump, with the features to match, and none of the bloat.

https://github.com/CallMeAlphabet/fasthex

fasthex swaps in for xxd or hexdump on Linux, but runs about 55 times faster than xxd and 140 times faster than hexdump thanks to memory mapping, multi threading, and AVX2 SIMD. It still handles all the display modes you'd expect, can reverse a dump back into binary, and needs nothing installed.

The benchmarks in the video are made with my timing utility timeit. The benchmarks in the video and in the table below as well the GitHub repo differ, because of caching and different testing conditions.

Benchmarks:

Tool Time Speed vs fasthex
fasthex 0.78s 1x (baseline)
xxd 43.62s 55.5x slower
hexyl¹ 53.14s 67.6x slower
hexyl 104.93s 133.5x slower
hexdump 116.03s 147.5x slower

¹ --color=never was used to avoid colors.

2 standout features:

  1. Reverse mode. Turns a hex dump back into binary with -r, something xxd can do but hexdump can't, useful for round tripping edited hex output straight back into a file.

  2. Zero dependency pre-built binary. One static x86_64 executable, no runtime libraries, no interpreter needed, drop it anywhere and it just runs.

Install:
Arch: paru -S fasthex / fasthex-bin

Non-arch:
cargo install fasthex

u/ItzAlphabet — 2 days ago