wolfssl-examples/hash/blake2
Anthony 73dde4a277 Add BLAKE2b/BLAKE2s examples
Incremental hashing checked against the RFC 7693 known-answer vectors,
plus BLAKE2b's native keyed mode used as a MAC.
2026-07-29 13:38:44 -04:00
..
Makefile Add BLAKE2b/BLAKE2s examples 2026-07-29 13:38:44 -04:00
README.md Add BLAKE2b/BLAKE2s examples 2026-07-29 13:38:44 -04:00
blake2-keyed-mac.c Add BLAKE2b/BLAKE2s examples 2026-07-29 13:38:44 -04:00
blake2b-hash.c Add BLAKE2b/BLAKE2s examples 2026-07-29 13:38:44 -04:00
blake2s-hash.c Add BLAKE2b/BLAKE2s examples 2026-07-29 13:38:44 -04:00

README.md

wolfSSL BLAKE2 Examples

Demonstrates the dedicated BLAKE2b/BLAKE2s wolfCrypt APIs (wc_Blake2b* / wc_Blake2s*), including BLAKE2's native keyed mode.

  • blake2b-hash.c - incremental BLAKE2b-512 hashing, verified against the RFC 7693 Appendix A test vector.
  • blake2s-hash.c - incremental BLAKE2s-256 hashing, verified against the RFC 7693 Appendix B test vector.
  • blake2-keyed-mac.c - keyed BLAKE2b as a MAC via wc_InitBlake2b_WithKey(). Unlike SHA-2, BLAKE2 does not need the HMAC construction to be used as a MAC.

Building wolfSSL

./configure --enable-blake2 --enable-blake2s
make
sudo make install

--enable-blake2 enables BLAKE2b, --enable-blake2s enables BLAKE2s.

Building and running the examples

make
./blake2b-hash [message]
./blake2s-hash [message]
./blake2-keyed-mac

With no argument the hash examples digest "abc" and compare against the RFC 7693 known-answer vectors.