Tinyxxd
Drop-in cross-platform replacement and standalone version of the hex dump utility that comes with ViM. Licensed only under MIT and/or GPL2 (dual license).
`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/binary, and also do the same thing in reverse: recreate files from hex/binary codes. There are also legacy and C include file conversions. The project is written primarily in C, distributed under the Other license, first published in 2024. Key topics include: c, c11, cross-platform, hex, hexadecimal.
TinyXXD <img src="img/tinyxxd.svg" width="128" align="right">
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/binary, and also do the same thing in reverse: recreate files from hex/binary codes. There are also legacy and C include file conversions.
tinyxxd is a standalone fork of xxd, a slight modernization of the C code, a solid performance increase and a drop-in replacement for xxd. It contains the same logic and supports the exact same flags. It is also only licensed under MIT and/or GPL2 (dual license), and not under the ViM license.
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 twice as fast.
tinyxxd only has the goal of supporting Linux, but it should also build and run on other UNIX-like platforms and on Windows.
Performance
The performance is mostly IO bound.
tinyxxd can be profiled by running make profile or benchmarked by running make bench.
tinyxxd is faster than xxd, and as the size of the input data grows, the performance advantage increases.
Note that this may be benchmarked as part of the CI test, which affects the benchmark results, especially for small amounts of test data:
For more details, take a look at the latest benchmark results, which are added by the CI benchmark.
Requirements
- A C-compiler that supports C11.
- For profiling:
valgrindandkcachegrind. - For benchmarking:
gcc,gnuplotandpython3. - For fuzzing:
afl-gccandafl-fuzz.
Packaging status
Source code
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.
Testing
Tested on Arch Linux and Fedora, where it builds, runs and all tests passes.
make test can be used to run simple tests, and make bench can run additional tests while benchmarking.
Platforms
tinyxxd also builds for macOS and Windows. There might be small variations of how tinyxxd behaves compared the xxd that comes with macOS.
Benchmarking
tinyxxd can be benchmarked by running make bench (or python bench.py/python3 bench.py).
The performance is mostly IO bound, which is reflected in the benchmark graphs.
Fuzzing
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.
Packaging
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.
General info
- License:
GPL-2.0-onlyand/orMIT. See theLICENSEfile for more information. - Version: 1.3.16
Contributors
Showing top 7 contributors by commit count.
