Skip to main content

Installation

This guide assumes all dependencies described in the Quickstart guide have been installed.

Usage

crypto3 should be added to a project as a git sub-module. crypto3 suite can be used as follows:

  1. Generic.
  2. Selective.
info

The suite is used as a header-only and is currently statically linked. Future versions will allow dynamic linking.

info

The suite is compatible with x86 and ARM architectures.

Generic

Generic usage of the cryptography suite consists of all modules listed here in the team repository.

The generic module can be added to your C++ project as follows

git submodule add https://github.com/NilFoundation/crypto3.git <dir>

Selective

The developer can select to include one or more modules to reduce the sources of resulting project and dependencies tree height. This, however, does require the developer to manually resolve all required dependencies and stay up-to-date regarding compatibility across modules.

Selective modules can be added to your project as follows:

git submodule add https://github.com/NilFoundation/crypto3-<lib>.git <dir>

Include

To compile anything in crypto3, you need a directory containing the crypto3 sub-module directory in your #include path. Since all of the crypto3 header files have the .hpp extension, and live in the crypto3\<lib> sub-directory of the crypto3 root, your crypto3 include directives will look like

#include <nil/crypto3/pubkey/algorithm/sign.hpp>

CMake

We recommend using CMake to provide paths/linker flags.

add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/<submodule-directory>")

Linker commands

target_link_libraries(${PROJECT_TARGET} <crypto3_library>)

Example:

add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/libs/crypto3")
target_link_libraries(${PROJECT_TARGET} crypto3::algebra)