Giter VIP home page Giter VIP logo

halo2-rsa's Introduction

halo2-rsa

RSA verification circuit using halo2 library.

Disclaimer

DO NOT USE THIS LIBRARY IN PRODUCTION. At this point, this is under development. It has known and unknown bugs and security flaws.

Features

This library provides a RSA verification circuit compatible with the halo2 library developed by privacy-scaling-explorations team. It will allow halo2 developers to write circuits for verifying RSA-based cryptographic schemes such as RSA signature, RSA accumulator, and verifiable delay function. Specifically, our library provides the following two chips.

  1. BigIntChip

The BigIntChip defines constraints for big integers, i.e. integers whose size is larger than that of the native field of the arithmetic circuit. You can perform various operations of the big integers, e.g. allocation, addition, subtraction, multiplication, modular operations, and comparison.

  1. RSAChip

The RSAChip defines constraints for verifying the RSA relations. That is, for the integer x and RSA public key (n, e), it computes x^e mod n. Moreover, it also supports the verification of pkcs1v15 signatures.

Current Development Status

We have completed the development of both chips. The BigIntChip and RSAChip is placed in the big_integer module and top module, respectively.

Requirement

  • rustc 1.65.0-nightly (0b79f758c 2022-08-18)
  • cargo 1.65.0-nightly (9809f8ff3 2022-08-16)

Installation and Build

You can install and build our library with the following commands.

git clone https://github.com/SoraSuegami/halo2_rsa.git
cd halo2_rsa
cargo build --release

Usage

You can open the API specification by executing the following command under the halo2_rsa directory.

cargo doc --open

Test

You can run the tests by executing the following command under the halo2_rsa directory.

cargo test

Authors

  • Sora Suegami

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Acknowledgments

We have developed our library by reference to the circom-rsa-verify repository, which contains a circuit of pkcs1v15 signature verification in the circom language. It verifies signatures by first defining a circuit for modular multiplication of big integers and then using the circuit to perform modular exponentiation.

We implemented our circuit using a similar approach. In addition, the range check, the verification of whether a given integer is within a certain range, was optimized using a lookup table. This optimization allows the prover to prove that multiple integers are in the specified range in batch.

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.