xxd
is a utility that comes with ViM. It can be used to view binary or text files as hex codes. It is often installed on UNIX-like systems. It can dump files to hex, and also do the same thing in reverse: recreate files from hex codes.
tinyxxd
is a standalone fork of xxd
, a slight modernization of the C code, a slight performance increase and a drop-in replacement for xxd
. It contains the same logic and supports the exact same flags.
tinyxxd
can be useful in connection with building and packaging software, since it's a smaller dependency than ViM
, only requires a C11 compiler and is slightly faster.
tinyxxd
only has the goal of supporting Linux, but it should also build and run on other UNIX-like platforms.
The performance is mostly IO bound.
tinyxxd
can be profiled by running make profile
or benchmarked by running make bench
.
tinyxxd
is just a tiny bit faster than xxd
, but as the size of the input data grows, the performance advantage appears to be increasing.
For more details, take a look at the latest benchmark results, which are added by the CI benchmark.
- A C-compiler that supports C11.
- For profiling:
valgrind
andkcachegrind
. - For benchmarking:
gcc
,gnuplot
andpython3
. - For fuzzing:
afl-gcc
andafl-fuzz
.
The source code for the program is a single main.c
source file, written in C11.
Some of the code has been neatly refactored into separate functions, and a couple of enums have been introduced.
Tested on Arch Linux, where it builds, runs and all tests passes.
make test
can be used to run simple tests, and python bench.py
can run additional tests while benchmarking.
tinyxxd
also builds for macOS and Windows (using Mingw), but it has not been tested properly on those platforms yet, and there might be variations on how it behaves compared to Linux.
tinyxxd
can be benchmarked by running python bench.py
(or python3 bench.py
).
The performance is mostly IO bound, which is reflected in the benchmark graphs.
make fuzz
can be used to build tinyxxd
with afl-gcc
and then start fuzzing the executable with varied input designed to find edge cases in the program.
In connection with packaging, letting this utility provide and replace xxd
, possibly by providing a /usr/bin/xxd
symlink that points to /usr/bin/tinyxxd
, is recommended.
- License:
GPL-2.0-only
and/orMIT
. See theLICENSE
file for more information. - Version: 1.3.7