Code Monkey home page Code Monkey logo

halo2curves's Introduction

A collection of Elliptic Curves for ZkCrypto traits

This library provides efficient and flexible implementations of various halo2-friendly elliptic curves, originally implementing the BN256 curve with traits from the zkcrypto ecosystem,

The implementations were originally ported from matterlabs/pairing and zkcrypto/bls12-381, but have been extended and optimized to cover a broader set of curves and use cases. Since its initial release, the library has expanded to include additional curves, along with the following features:

  • secp256k1, secp256r1, and grumpkin curves, enhancing its usability across a range of cryptographic protocols.
  • Assembly optimizations leading to significantly improved performance.
  • Various features related to serialization and deserialization of curve points and field elements.
  • Curve-specific optimizations and benchmarking capabilities.

Benchmarks

Benchmarking is supported through the use of Rust's built-in test framework. Benchmarks can be run without assembly optimizations:

$ cargo test --profile bench test_field -- --nocapture

or with assembly optimizations:

$ cargo test --profile bench test_field --features asm -- --nocapture

Additional Features

  1. Derivation of Serialize/Deserialize: The library supports Serde's Serialize and Deserialize traits for field and group elements, making it easier to integrate curve operations into serialization-dependent workflows.

  2. Hash to Curve: For the bn256::G1 and grumpkin::G1 curves, hash_to_curve is implemented, enabling more efficient hash-and-sign signature schemes.

  3. Lookup Table: A pre-computed lookup table is available for bn256::Fr, accelerating conversion from u16 to montgomery representation.

Structure

The library's top-level directories are organized as follows:

  • benches: Contains benchmarking tests.
  • script: Contains utility scripts.
  • src: Contains the source code of the library, further subdivided into modules for each supported curve (bn256, grumpkin, secp256k1, secp256r1, pasta) and additional functionalities (derive, tests).

halo2curves's People

Contributors

ashwhitehat avatar brechtpd avatar cperezz avatar davidnevadoc avatar dmpierre avatar georgwiese avatar han0110 avatar huitseeker avatar jonathanpwang avatar kilic avatar mratsim avatar rrrliu avatar zhenfeizhang 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.