Skip to content

Examples

Each directory is one program with one subject. They build and run on their own, and each has a README explaining what it shows.

01-hello-hash one-shot hashing, and what a digest is try it
02-incremental hasher, for input that arrives in pieces try it
03-keyed-and-derive-key the MAC mode and the KDF mode try it
04-extended-output output of any length, and O(1) seeking into it try it
05-hash-a-file hash_file, update_file, and the two error conventions try it
06-multi-core a scheduler, and why the digest does not change try it
07-which-kernel what the binary carries, what the CPU can run try it

The last three combine those choices, which is where the design shows:

08-keyed-and-extended-output a MAC of any width, and an authenticated keystream try it
09-one-file-two-ways the same file sequentially and across cores try it
10-authenticated-manifest keyed hashing, files and verification together try it

Read them in order for a tour of the library, or jump to the one that matches the problem in front of you.

Building them

They are on by default when blake3pp is the top-level project:

cmake --preset linux-gcc16-cxx26
cmake --build build/linux-gcc16-cxx26
ctest --test-dir build/linux-gcc16-cxx26 -R blake3pp_example

Each one is also a test, so ctest running them is what keeps them describing the library as it currently is. To leave them out of a build, configure with -DBLAKE3PP_BUILD_EXAMPLES=OFF.