Show HN: Hexi, modern header-only network binary serialisation for C++ hackers
Published on: 2025-05-24 14:37:42
Hexi is a lightweight, header-only C++23 library for safely handling binary data from arbitrary sources (but primarily network data). It sits somewhere between manually memcpying bytes from network buffers and full-blown serialisation libraries.
The design goals are ease of use, safety when dealing with untrusted data, a reasonable level of flexibility, and keeping overhead to a minimum.
What Hexi doesn't offer: versioning, conversion between different formats, handling of text-based formats, unloading the dishwasher.
Incorporating Hexi into your project is simple! The easiest way is to simply copy hexi.h from single_include into your own project. If you'd rather only include what you use, you can add include to your include paths or incorporate it into your own CMake project with target_link_library . To build the unit tests, run CMake with ENABLE_TESTING .
Here's what some libraries might call a very simple motivating example:
# include < hexi.h > # include < array > # include <
... Read full article.