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

#1635 in Cryptography

Download history 14172/week @ 2024-12-08 11933/week @ 2024-12-15 4280/week @ 2024-12-22 5220/week @ 2024-12-29 14178/week @ 2025-01-05 16407/week @ 2025-01-12 14230/week @ 2025-01-19 14301/week @ 2025-01-26 17156/week @ 2025-02-02 20202/week @ 2025-02-09 17478/week @ 2025-02-16 16875/week @ 2025-02-23 16131/week @ 2025-03-02 16418/week @ 2025-03-09 15128/week @ 2025-03-16 16025/week @ 2025-03-23

64,697 downloads per month
Used in 42 crates (8 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

~0.8–1.5MB
~31K SLoC