Giter VIP home page Giter VIP logo

libff's Introduction

libff

C++ library for Finite Fields and Elliptic Curves

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:

  • libff: C++ source code, containing the following modules:
    • algebra: fields and elliptic curve groups
    • common: miscellaneous utilities
  • depends: dependency libraries

Elliptic curve choices

The libsnark library currently provides three options:

  • edwards: an instantiation based on an Edwards curve, providing 80 bits of security.

  • bn128: an instantiation based on a Barreto-Naehrig curve, providing 128 bits of security. The underlying curve implementation is [ate-pairing], which has incorporated our patch that changes the BN curve to one suitable for SNARK applications.

    • This implementation uses dynamically-generated machine code for the curve arithmetic. Some modern systems disallow execution of code on the heap, and will thus block this implementation.

      For example, on Fedora 20 at its default settings, you will get the error zmInit ERR:can't protect when running this code. To solve this, run sudo setsebool -P allow_execheap 1 to allow execution, or use make CURVE=ALT_BN128 instead.

  • alt_bn128: an alternative to bn128, somewhat slower but avoids dynamic code generation.

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 ..

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

libff's People

Contributors

howardwu avatar aleksejspopovs avatar chfast avatar madars avatar tromer avatar kobigurk avatar

Watchers

Yishai Wiesner avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.