Coder Social home page Coder Social logo

poseidon-circuit's Introduction

poseidon-circuit

Poseidon hash circuit and primitives. It integrated several poseidon hash schemes from zcash and iden3 and support sponge progress for hashing messages in any length.

Usage

To connect to the hash circuit, see spec/hash-table.md.

The circuit code can be implied with field which have satisified Hashable trait and currently only poseidon-circuit::Bn256Fr (the alias of halo2_proofs::halo2curves::bn256::Fr) has satisified this trait.

The circuit type under hash::HashCircuit prove poseidon hash progress base on permutation with 3 fields and a 2 fields rate. You also need to set a fixed step size for proving message hashing with variable length. A message has to be complied with an initial capacity size and for each sponge step the capacity would be substracted by the fixed step size. In the final step the capacity has to be equal or less than the fixed step.

For example, when we hashing a message with 19 fields:

  1. You can use a circuit with fixed step size as 2, and set the initialized capacity as 19 (i.e. the field len of input message). In each sponge progess the capacity is reduced by 2 and in final step it became 1;

  2. You can use a circuit with fixed step size as 32 and a initialized capacity between 298 to 320.

The DEFAULT_STEP being decalred in the crate is 32.

Installation

Add Cargo.toml under [dependencies]:

[dependencies]
poseidon-circuit = { git = "https://github.com/scroll-tech/poseidon-circuit.git" }

License

Licensed under either of

at your option.

poseidon-circuit's People

Contributors

icemelon avatar naure avatar noel2004 avatar roynalnaruto 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.