Yet Another Cryptographic Library for Research
June 4, 2026 · View on GitHub
██╗ ██╗ █████╗ ██████╗██╗ ██████╗
╚██╗ ██╔╝██╔══██╗██╔════╝██║ ██╔══██╗
╚████╔╝ ███████║██║ ██║ █████╗██████╔╝
╚██╔╝ ██╔══██║██║ ██║ ╚════╝██╔══██╗
██║ ██║ ██║╚██████╗███████╗ ██║ ██║
╚═╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ ╚═╝ ╚═╝
Yacl-r is a fork and extension of the C++ crypto library secretflow/yacl. It provides research implementations of cryptographic and secure-computation building blocks, including OT, VOLE, TPRE, DPF, PRG, RO, AES, hashing, public-key encryption, signatures, and supporting math/link utilities.
Warning
Yacl-r is under heavy development. APIs, module layout, and build options may change.
Target platforms: Linux x86_64, Linux aarch64, and macOS Apple Silicon.
Repo Layout
- aead, aes, block_cipher, hash, hmac: symmetric crypto, hashing, and authentication primitives.
- pke, sign, envelope, tpre: public-key, signature, envelope, and threshold proxy re-encryption code.
- ot: base OT, OT extension, OT stores, and SimplestOT backends.
- vole: base VOLE, MP-VOLE, MPFSS, and silent VOLE code.
- mpc: higher-level MPC kernels and plaintext/secret-sharing executors.
- dpf, oprf, snark: additional protocol implementations.
- io: streaming I/O and Bristol Fashion circuit parsing.
- link: RPC-style SPMD communication utilities.
- math: big integers, finite fields, ECC, and pairing support.
- rand: randomness, DRBG, entropy source, and OpenSSL provider code.
- utils: common types, buffers, exceptions, serialization, and helper utilities.
- theoretical_tools: PRG/RO/code utilities used by protocol implementations.
- experimental: experimental components that are not part of the stable module layout.
- cmake: CMake modules, dependency scripts, and dependency patches.
Prerequisites
- GCC >= 11 or Clang >= 12 with C++20 support
- CMake >= 3.20
- Ninja or Make
- Perl 5 with core modules, required by OpenSSL
patch, required for dependency patching- GMP development files available on the system
Ubuntu example:
sudo apt install -y git cmake ninja-build gcc g++ patch libgmp-dev
Build
Yacl-r uses CMake.
# Configure a Release build.
cmake -S . -B build -G Ninja
# Configure a Debug build.
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Debug
# Build.
cmake --build build -j$(nproc)
Build fuzz targets with Clang/libFuzzer:
cmake -S . -B build-fuzz -G Ninja \
-DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ \
-DBUILD_FUZZ=On
cmake --build build-fuzz -j$(nproc)
Test
Run tests from the build directory:
cd build
ctest --output-on-failure
ctest -R plaintext_executor_test --output-on-failure
./bin/buffer_test
Formatting And Checks
No pre-commit or automated license-header check is configured in this repo. Use the regular build, test, and focused formatting/linting commands instead:
clang-format -i path/to/file.cc
clang-tidy path/to/file.cc -- -p build
cmake --build build -j$(nproc)
ctest --output-on-failure
Install
Yacl-r supports cmake --install.
cmake -S . -B build
cmake --build build -j$(nproc)
cmake --install build
# Or install into a custom prefix.
cmake --install build --prefix /path/to/prefix
Vendored third-party dependencies are installed into a private subtree inside the install prefix instead of being copied into system-wide include/library locations:
- public headers:
include/yacl-r/yacl/... - private vendored headers:
include/yacl-r/deps/... - private vendored libraries:
lib*/yacl-r/deps/...
This keeps Yacl-r's bundled dependencies isolated from the system toolchain and from unrelated projects. GMP is still resolved as a system dependency at package-consume time.
Consumers can use the installed package via CMake:
find_package(Yacl CONFIG REQUIRED)
target_link_libraries(your_target PRIVATE Yacl::yacl)
The exported target adds include/yacl-r to the include path, so installed
consumers include public headers as #include "yacl/...".
License
See LICENSE.