Git Product home page Git Product logo

ecclib's Introduction

ecclib Build Status Codacy Badge

ecclib provides basic Elliptic Curve math operations in a library which loosely follows the conventions of the GNU Multiple Precision (GMP) math library. For details on GMP, see: https://gmplib.org/.

ecclib provides basic handling of math within the multiplicative field of integers modulo an odd prime p (i.e. the ring Z/pZ, also denoted Zp) and extends that capability to elliptic curve points over that ring, i.e. E(Fp).

The implementation leverages complete addition formulae for all curve types, The Edwards and Twisted Edwards addition laws are complete by default. The short Weierstrass implementation uses the Renes, Costello and Batina complete addition formula (i.e. add and double are the exact same algorithm). In order to provide the full set of operations Montgomery curves are transformed to short Weierstrass and use the same formula. In all cases the multiplication is via the Brier-Joye ladder.

capabilities

Basic operations:

  • import/export
  • element (x,y) composition/decomposition

Supported multiplicative group operations:

  • addition
  • subtraction
  • negation
  • multiplication
  • exponentiation
  • modular inversion
  • square root

Supported elliptic curve point mathematical operations:

  • addition
  • subtraction
  • doubling
  • negation
  • scalar multiplication
  • scalar base multiplication

Supported elliptic curve types:

  • short Weierstrass
  • Edwards
  • twisted Edwards
  • Montgomery (implemented internally via transform to short Weierstrass form)

Supported cryptography operations

  • ECDSA
  • Elliptic Curve Elgamal

build and install

libecc follows the traditional GNU autotools build process so it should build without issue on most platforms where autotools is present. GMP is the only dependency (though by default unit tests are built which use libcheck and libsodium so to build with only GMP you'll need to pass the option --disable-unit-tests to configure)

Example build and install sequence:

$ autoreconf --install
$ ./configure --prefix=/usr
$ make
$ make check
$ sudo make install

Note: if you want to run the benchmarks you'll need to install libsodium and also pass the --enable-benchmarks option to configure. Building the examples is enabled via --enable-examples.

Python bindings

Once you have installed the underlying C libraries you can install the python API interface. This interface is only tested with python3. The python API can be installed (and tested) with commands like:

$ sudo pip3 install --upgrade .
$ python3 ./tests/pytest_field.py
$ python3 ./tests/pytest_ecurve.py
$ python3 ./tests/pytest_ecpoint.py

Go bindings

Once the underlying C libraries are installed, you can install the golang API (which attempts to follow the semantics of math/big) to use the library in Go programs.

$ go get github.com/jadeblaquiere/ecclib/ecgo

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.