Home

Awesome

<h1 align="center">libff</h1> <h4 align="center">C++ library for Finite Fields and Elliptic Curves</h4>

libff is a C++ library for finite fields and elliptic curves. The library is developed by SCIPR Lab and contributors (see AUTHORS file) and is released under the MIT License (see LICENSE file).

Table of contents

Directory structure

The directory structure is as follows:

Elliptic curve choices

The libsnark library currently provides three options:

Note that bn128 requires an x86-64 CPU while the other curve choices should be architecture-independent.

Build guide

The library has the following dependencies:

The library has been tested on Linux, but it is compatible with Windows and Mac OS X.

Installation

On Ubuntu 14.04 LTS:

sudo apt-get install build-essential git libboost-all-dev cmake libgmp3-dev libssl-dev libprocps3-dev pkg-config

Fetch dependencies from their GitHub repos:

git submodule init && git submodule update

Compilation

To compile, starting at the project root directory, create the build directory and Makefile:

mkdir build && cd build
cmake ..

If you are on macOS, change the cmake command to be cmake .. -DOPENSSL_ROOT_DIR=$(brew --prefix openssl)

Optionally, you can specify the install location by providing the desired install path prefix:

cmake .. -DCMAKE_INSTALL_PREFIX=/install/path

Then, to compile and install the library, run this within the build directory:

make
make install

This will install libff.a into /install/path/lib; so your application should be linked using -L/install/path/lib -lff. It also installs the requisite headers into /install/path/include; so your application should be compiled using -I/install/path/include.

Testing

To execute the tests for this library, run:

make check

Code formatting and linting

To run clang-tidy on this library, specify the variable USE_CLANG_TIDY (eg. cmake .. -D USE_CLANG_TIDY=ON). Then, run:

make clang-tidy

One can specify which clang-tidy checks to run and which files to run clang-tidy on using the .clang-tidy file in the root directory of the project.

Profile

To compile the multi-exponentiation profiler in this library, run:

make profile

The resulting profiler is named multiexp_profile and can be found in the libff folder under the build directory.