SimpleSerializeC is a C library implementing the Simple Serialize (SSZ) specification. SSZ is a serialization format designed for simplicity and efficiency.
The following table lists the types currently supported for both serialization and deserialization:
Type | Serialization Support | Deserialization Support |
---|---|---|
uint8 |
✅ | ✅ |
uint16 |
✅ | ✅ |
uint32 |
✅ | ✅ |
uint64 |
✅ | ✅ |
uint128 |
✅ | ✅ |
uint256 |
✅ | ✅ |
boolean |
✅ | ✅ |
bitvector |
✅ | ✅ |
bitlist |
✅ | ✅ |
vector |
✅ | ✅ |
list |
✅ | ✅ |
unions |
🧪 (Experimental) | 🧪 (Experimental) |
For further details regarding the public API, please refer to the header files ssz_serialize.h
and ssz_deserialize.h
.
The library includes functions for computing a Merkle root over contiguous chunks of data. For detailed usage, please refer to the API in the header file ssz_merkle.h
.
The necessary public functions in this library have been benchmarked where the detailed results can be found in this project's wiki section. These results can be replicated by using commands listed in the Running Benchmarks section.
- A C compiler (e.g., GCC, Clang) supporting C99 or later. (Note: The library is written in C99 and should compile on any platform with a C99 compiler; it has been tested on MacOS, Linux, and Windows.)
make
(for building the library, tests and benchmarks).
The project includes a Makefile
to simplify the build process. The Makefile
provides the following targets:
all
: Builds the static library (libssz.a
), test binaries, and benchmark binaries.test
: Builds everything and runs all test binaries.bench
: Builds and runs all benchmark binaries.clean
: Removes all build artifacts, including object files, binaries, and the static library.
The library includes benchmarks to evaluate the performance of SSZ serialization and deserialization. Here are the commands supported for benchmarking:
- Run all benchmarks:
make bench
- Run a specific benchmark (e.g.,
serialize
):
make bench serialize
The library includes test binaries that verify the functionality of SSZ serialization and deserialization. To ensure compliance with the SSZ specification, it implements all the generic test vectors. Below are the commands supported for testing:
- Run all tests:
make test
- Run a specific test (e.g.,
serialize
):
make test serialize
This project incorporates a SHA-256 implementation sourced from libmincrypt, which is originally part of the Android Open Source Project.
This project includes code from an external source, which is covered by its respective license.
This project is licensed under the MIT License. See the LICENSE-MIT
file for details.
This project implements the SHA256 implementation from libmincrypt, which is licensed under the BSD-3-Clause License. See the LICENSE-BSD
file for details.
Contributions are welcome! Please open an issue or submit a pull request for any improvements, bug fixes, or additional benchmarks.