Skip to content

Lagrange-Labs/plonky2-crypto

 
 

Repository files navigation

Fork: updated to compile and testable with latest versions of plonky2

Crypto Gadgets for Plonky2

A collection of efficient gadgets for Plonky2.

As we're building larger and larger circuits with Plonky2, we want to share some of our work and optimizations, packaged in a single and simple to use library.

Complete Example

See the hello-world example to get started and build your own circuit.

Or run:

cd examples/hello-world
cargo test --release -- --nocapture

(don't forget the --release!)

For more examples you can run the library tests:

cargo test --release -- --nocapture

Features

Hash functions:

  • Sha256
    • Hash Arbitrary Length Data
    • Hash Two to One (For use with Merkle Proofs)
    • Merkle Proof Gadget
    • Delta Merkle Proof Gadget
  • Keccak256
    • Hash Arbitrary Length Data
    • Hash Two to One (For use with Merkle Proofs)
    • Merkle Proof Gadget
    • Delta Merkle Proof Gadget

Integer arithmetic:

  • Uint32 arithmetic ops (add, mul, ...)
  • Uint32 bitwise ops (and, xor, ...)
  • BigUint arithmetic ops (add, sub, mul, div/rem, ...)
  • BigUint optimized mul, sqr

Finite field arithmetic:

  • Prime fields
  • Extension fields
  • Extension towers

Elliptic curve cryptography:

  • ECDSA (secp256k1)
  • EDDSA (ed25519)
  • BLS (bls12-381)

Contribute

We welcome contribution, whether in form of bug fixed, documentation, new gadgets, new functionality.

Just open an issue to discuss what you'd like to contribute and then submit a PR.

Disclaimer. This alpha software has been open sourced. All software and code are provided “as is,” without any warranty of any kind, and should be used at your own risk.

Releases

No releases published

Packages

No packages published

Languages

  • Rust 99.9%
  • Makefile 0.1%