Skip to content

deeplex/libb2-reforged

Repository files navigation

libb2-reforged

This is a rebottled version of the reference BLAKE2 implementations built on top of the original repository. In the spirit of the original libb2 we added a runtime dispatch for the various SIMD accelerated implementation flavors.

Special care has been taken to keep the commit history intact and the implementation traceable.

Building

A CMake based build system is provided. To build and install the library, run the following commands in the root of the repository:

cmake -G "Ninja Multi-Config" -B build -S . -DCMAKE_TOOLCHAIN_FILE= -DBUILD_TESTING=OFF
cmake --build build --config Debug
sudo cmake --build build --config Debug --target install
cmake --build build --config Release
sudo cmake --build build --config Release --target install

We also provide CMakePresets for the valid combinations of {x64, arm64} x {Linux, macOS, Windows} x {Clang, GCC, MSVC}.

The build system supports the following noteworthy options:

  • -DBUILD_TESTING=ON|OFF: Enable or disable building the test suite. Default is ON.
  • -DBUILD_SHARED_LIBS=ON|OFF: Build shared or static libraries. Default is OFF (static).
  • -DDPLX_BLAKE2_WITH_LIBB2_COMPAT=ON|OFF: Enable or disable building the compatibility layer for libb2. Default is ON.

Note that the test suite uses certain dependencies which are installed via vcpkg by default. If you do not have vcpkg installed, you can disable the tests by passing -DBUILD_TESTING=OFF and -DCMAKE_TOOLCHAIN_FILE= to the CMake configuration step.

Additionally you can install this library via the vcpkg port provided by the deeplex registry.

libb2 / BLAKE2 Compatibility Layer

We optionally provide a drop-in compatibility header blake2.h which mimics the original API of BLAKE2 which is largely compatible with the one of libb2. libb2's one-shot convenience functions have a different signature (see BLAKE2/libb2#47) and are not provided.

LICENSE

All code is triple-licensed under the [CC0](http://creativecommons.org/publicdomain/zero/1.0), the [OpenSSL Licence](https://www.openssl.org/source/license.html), or the [Apache Public License 2.0](http://www.apache.org/licenses/LICENSE-2.0), at your choosing.