{"id":13645395,"url":"https://github.com/scipr-lab/libff","last_synced_at":"2025-12-30T00:11:31.656Z","repository":{"id":46575571,"uuid":"62971935","full_name":"scipr-lab/libff","owner":"scipr-lab","description":"C++ library for Finite Fields and Elliptic Curves","archived":false,"fork":false,"pushed_at":"2021-10-05T05:35:39.000Z","size":664,"stargazers_count":155,"open_issues_count":36,"forks_count":88,"subscribers_count":16,"default_branch":"develop","last_synced_at":"2025-04-17T21:24:11.261Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/scipr-lab.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-07-09T22:40:56.000Z","updated_at":"2025-03-04T19:43:59.000Z","dependencies_parsed_at":"2022-08-26T02:42:42.383Z","dependency_job_id":null,"html_url":"https://github.com/scipr-lab/libff","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scipr-lab%2Flibff","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scipr-lab%2Flibff/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scipr-lab%2Flibff/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scipr-lab%2Flibff/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/scipr-lab","download_url":"https://codeload.github.com/scipr-lab/libff/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250070173,"owners_count":21369839,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-02T01:02:34.460Z","updated_at":"2025-12-30T00:11:31.627Z","avatar_url":"https://github.com/scipr-lab.png","language":"C++","funding_links":[],"categories":["C++"],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003elibff\u003c/h1\u003e\n\u003ch4 align=\"center\"\u003eC++ library for Finite Fields and Elliptic Curves\u003c/h4\u003e\n\n___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).\n\n## Table of contents\n\n- [Directory structure](#directory-structure)\n- [Elliptic curve choices](#elliptic-curve-choices)\n- [Build guide](#build-guide)\n\n## Directory structure\n\nThe directory structure is as follows:\n\n* [__libff__](libff): C++ source code, containing the following modules:\n  * [__algebra__](libff/algebra): fields and elliptic curve groups\n  * [__common__](libff/common): miscellaneous utilities\n* [__depends__](depends): dependency libraries\n\n## Elliptic curve choices\n\nThe libsnark library currently provides three options:\n\n* `edwards`:\n   an instantiation based on an Edwards curve, providing 80 bits of security.\n\n* `bn128`:\n   an instantiation based on a Barreto-Naehrig curve, providing 128\n   bits of security. The underlying curve implementation is\n   \\[ate-pairing], which has incorporated our patch that changes the\n   BN curve to one suitable for SNARK applications.\n\n    *   This implementation uses dynamically-generated machine code for the curve\n        arithmetic. Some modern systems disallow execution of code on the heap, and\n        will thus block this implementation.\n\n        For example, on Fedora 20 at its default settings, you will get the error\n        `zmInit ERR:can't protect` when running this code. To solve this,\n        run `sudo setsebool -P allow_execheap 1` to allow execution,\n        or use `make CURVE=ALT_BN128` instead.\n\n* `alt_bn128`:\n   an alternative to `bn128`, somewhat slower but avoids dynamic code generation.\n\nNote that `bn128` requires an x86-64 CPU while the other curve choices\nshould be architecture-independent.\n\n## Build guide\n\nThe library has the following dependencies:\n\n* [Boost](http://www.boost.org/)\n* [CMake](http://cmake.org/)\n* [GMP](http://gmplib.org/)\n* [libsodium](https://libsodium.gitbook.io/doc/)\n* [libprocps](http://packages.ubuntu.com/trusty/libprocps-dev) (turned off by default)\n\nThe library has been tested on Linux, but it is compatible with Windows and MacOS.\n\n### Installation\n\nOn Ubuntu 14.04 LTS:\n\n```\nsudo apt-get install build-essential git libboost-all-dev cmake libgmp3-dev libssl-dev libprocps3-dev pkg-config libsodium-dev\n```\n\n\nOn MacOS, all of the libraries from the previous section can be installed with `brew`, except for `libprocps`, which is turned off by default.\n\nFetch dependencies from their GitHub repos:\n\n```\ngit submodule init \u0026\u0026 git submodule update\n```\n\n### Compilation\n\nTo compile, starting at the project root directory, create the build directory and Makefile:\n\n```\nmkdir build \u0026\u0026 cd build\ncmake ..\n```\n\nIf you are on macOS, change the cmake command to be\n\n```\ncmake .. -DOPENSSL_ROOT_DIR=$(brew --prefix openssl)\n```\n\nOther build flags include:\n| Flag | Value | Description |\n| ---- | ----- | ----------- |\n| MAKE_INSTALL_PREFIX | (your path) | Specifies the desired install location. |\n| CMAKE_BUILD_TYPE | Debug | Enables asserts. Note that tests now use gtest instead of asserts. |\n| WITH_PROCPS | ON | Enables `libprocps`, which is by default turned off since it is not supported on some systems such as MacOS. |\n\nThen, to compile and install the library, run this within the build directory:\n```\nmake\nmake install\n```\n\nThis 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`.\n\n## Testing\n\nTo build and execute the tests for this library, run:\n```\nmake check\n```\n\n## Code formatting and linting\n\nTo run clang-tidy on this library, specify the variable `USE_CLANG_TIDY` (eg. `cmake .. -D USE_CLANG_TIDY=ON`).\nThen, run:\n```\nmake clang-tidy\n```\n\nOne 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.\n\n## Profile\n\nTo compile the multi-exponentiation profiler in this library, run:\n```\nmake profile\n```\nThe resulting profiler is named `multiexp_profile` and can be found in the `libff` folder under the build directory.\n\n[SCIPR Lab]: http://www.scipr-lab.org/ (Succinct Computational Integrity and Privacy Research Lab)\n\n[LICENSE]: LICENSE (LICENSE file in top directory of libff distribution)\n\n[AUTHORS]: AUTHORS (AUTHORS file in top directory of libff distribution)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscipr-lab%2Flibff","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fscipr-lab%2Flibff","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscipr-lab%2Flibff/lists"}