4 releases (2 breaking)

0.4.0 Nov 7, 2023
0.3.0 Oct 26, 2023
0.2.1 Aug 1, 2023
0.2.0 Jul 28, 2023

#1756 in Cryptography

Download history 9880/week @ 2024-07-02 12502/week @ 2024-07-09 14609/week @ 2024-07-16 14193/week @ 2024-07-23 11558/week @ 2024-07-30 11506/week @ 2024-08-06 14387/week @ 2024-08-13 14672/week @ 2024-08-20 12931/week @ 2024-08-27 15463/week @ 2024-09-03 16841/week @ 2024-09-10 14528/week @ 2024-09-17 16601/week @ 2024-09-24 17282/week @ 2024-10-01 17824/week @ 2024-10-08 18707/week @ 2024-10-15

72,927 downloads per month
Used in 42 crates (9 directly)

MIT/Apache

155KB
3.5K SLoC

This crate exposes the main traits and core structures of the bellpepper library.


lib.rs:

bellpepper is a crate for building zk-SNARK circuits. It provides circuit traits and and primitive structures, as well as basic gadget implementations such as booleans and number abstractions.

Example circuit

Say we want to write a circuit that proves we know the preimage to some hash computed using SHA-256d (calling SHA-256 twice). The preimage must have a fixed length known in advance (because the circuit parameters will depend on it), but can otherwise have any value. We take the following strategy:

  • Witness each bit of the preimage.
  • Compute hash = SHA-256d(preimage) inside the circuit.
  • Expose hash as a public input using multiscalar packing.

Dependencies

~1.2–1.8MB
~37K SLoC