Git Product home page Git Product logo

crypto3-algebra's People

Contributors

cblpok-git avatar etatuzova avatar iluvmagick avatar ilyas675 avatar jasoncoombs avatar luannet avatar martun avatar nemothenoone avatar nkaskov avatar noamdev avatar rinat229 avatar sk0m0r0h avatar vo-nil avatar x-mass avatar zerg1996 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

crypto3-algebra's Issues

Group and group element type traits

  • Add type trait for Group
  • Add type trait for Group element
  • Add type trait for Curve group element
  • Add check, that set of methods is correct, to curve policies

matrix class does not work with field elements

UPDATE: Unrelated to field , also fails with double type.

typedef bls12_fq<381>::value_type bls12_base_f;

int main() {
    constexpr auto f1 = bls12_base_f(0x1);
    constexpr auto f2 = bls12_base_f(0x2);

    constexpr matrix<bls12_base_f,2,2> m1 = {{{f1, f2}, {f1, f2}}};
    constexpr matrix<bls12_base_f,2,2> m2 = {{{f2, f1}, {f2, f1}}};

    auto m3 = m1 + m2;
    return 0;
}

The above snippet fails with the below error

/home/hgedia/Development/nil/crypto3-scaffold/src/bls/src/main.cpp:18:18: error: invalid operands to binary expression ('const matrix<bls12_base_f, 2, 2>' (aka 'const matrix<element_fp<params<bls12_base_field<381>>>, 2, 2>') and 'const matrix<bls12_base_f, 2, 2>' (aka 'const matrix<element_fp<params<bls12_base_field<381>>>, 2, 2>'))
    auto m3 = m1 + m2;

Remove temporary marshalling

Because the stable version of marshalling is ready, it's time to transfer all the functions we want have in algebra marshalling from algebra to the crypto3::marshalling.

Introduce separate elements for different curves representations

Each new curve implementation right now requires it's own group element implementation. However, most of our curves are of the same representations. There is no need to implement it from scratch every time. If we introduce separate elements for different curves representations, we will be able to add new curves extremely fast.

Bring new curves

Bringing a new curve requires to do just two things:

  • Add field description (like here);
  • Add curve params (like here);
  • Add curve group type struct and public policy.

There is a great source of many common curves in a easy-readable form: https://github.com/J08nY/std-curves

This process most probably can be automatized with simple python json parser.

Bring BN-128 optimizations

Implementation of BN-128 currently differs from other curves. It relies now on the double_element structure. Looks like not the best way to implement it.
The current implementation also requires a lot of specific functions inside the element structures.
We need to review and debug it.

Add quadratic non-residues to Vesta/Pallas curve parameters.

Having access to a precomputed quadratic non-residue is useful for circuits.
An example is an 'and' operation, merging two constraints f(x) = 0, g(x) = 0 into a single one
f^2(x) - p * g^2(x) = 0
This can be used to build complex constraints like 'either both f and g are 0, or both q and r are zero'.

Review pairing implementation

Pairings require thorough debug and testing:

  • * ALT-BN128
  • * BLS12-381
  • * BLS12-377
  • * BN128
  • * Edwards-183
  • * MNT-4
  • * MNT-6

The following pairings do not compile now:

  • ALT-BN128
  • BN128

Making pairing for ALT-BN128 compiled is the easiest subtask.

Pairing for BLS12-377 undone at all.

Add support of arbitrary multiprecision backend

Our current implementation is hardly bound to multiprecision cpp_int modular_adaptor backend.
The problem partially is that we have a lot of constexpr defined things, which are not supported by gmp and tommath backends. Probably we need to add some conversions between backends in the multiprecision.

Multiexp tests

Multiexp algorithms have no actual tests at the moment.
We need to add some JSON-based tests to be sure of its correctness.

Algebra Documentation

We need to introduce the first full version of documentation for each crypto3-module.

  • Module Description
  • Getting Started Guide
  • API description:
    • algorithms
    • curves
    • detail
    • fields
    • matrix
    • multiexp (including multiprecision part)
    • pairing
    • scalar
    • vector
  • Internal algorithms description
  • Examples
  • Extension Example / Guide
  • Architecture

Review group implementations

Right now g1_type and g2_type are a mixture of group element and group policy concepts. This has to be split to comply to the generic architecture.

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.