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

#2141 in Cryptography

Download history 16823/week @ 2024-10-26 12985/week @ 2024-11-02 13483/week @ 2024-11-09 15807/week @ 2024-11-16 11642/week @ 2024-11-23 14718/week @ 2024-11-30 14379/week @ 2024-12-07 12156/week @ 2024-12-14 4403/week @ 2024-12-21 4953/week @ 2024-12-28 13810/week @ 2025-01-04 16796/week @ 2025-01-11 13893/week @ 2025-01-18 14409/week @ 2025-01-25 17321/week @ 2025-02-01 19779/week @ 2025-02-08

68,213 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.7–1.4MB
~29K SLoC