5 releases (breaking)

Uses new Rust 2021

0.5.0 Sep 30, 2022
0.4.0 May 2, 2022
0.3.0 Nov 5, 2021
0.2.0 Oct 6, 2021
0.1.0 Sep 27, 2021

#774 in Cryptography

Download history 62/week @ 2022-08-13 36/week @ 2022-08-20 28/week @ 2022-08-27 31/week @ 2022-09-03 43/week @ 2022-09-10 57/week @ 2022-09-17 79/week @ 2022-09-24 75/week @ 2022-10-01 40/week @ 2022-10-08 45/week @ 2022-10-15 33/week @ 2022-10-22 65/week @ 2022-10-29 64/week @ 2022-11-05 40/week @ 2022-11-12 45/week @ 2022-11-19 28/week @ 2022-11-26

189 downloads per month
Used in 5 crates

Apache-2.0

24KB
485 lines

TBD

CI Apache-2 Dependencies

Library providing privacy enhancing cryptographic primitives.

Primitives

  1. Schnorr proof of knowledge protocol to prove knowledge of discrete log. This is a good reference.
  2. BBS+ signature for anonymous credentials. Based on the paper Anonymous Attestation Using the Strong Diffie Hellman Assumption Revisited
  3. Dynamic accumulators, both positive and universal. Based on the paper Dynamic Universal Accumulator with Batch Update over Bilinear Groups
  4. Composite proof system that combines above primitives for use cases like
    • prove knowledge of a BBS+ signature and the corresponding messages
    • equality of signed messages (from same or different signatures) in zero knowledge
    • the (non)membership of a certain signed message(s)in the accumulator
    • numeric bounds (min, max) on the messages can be proved in zero-knowledge
    • verifiable encryption of signed messages under BBS+.
    • zk-SNARK created from R1CS and WASM generated by Circom with witnesses as BBS+ signed messages (not exclusively though).
  5. Verifiable encryption using SAVER.
  6. Compression and amortization of Sigma protocols. This is PoC implementation.

Composite proof system

The proof system that uses above-mentioned primitives.

Build

cargo build or cargo build --release

By default, it uses standard library and rayon for parallelization

To build with standard library but without parallelization, use cargo build --no-default-features --features=std

For no_std support, build as cargo build --no-default-features --features=wasmer-sys

For WASM, build as cargo build --no-default-features --features=wasmer-js --target wasm32-unknown-unknown

Test

cargo test

The above maybe slower as it runs the tests in debug mode and some tests work on large inputs. For running tests faster, run cargo test --release

Benchmarking

Criterion benchmarks here

Some tests also print time consumed by the operations, run cargo test --release -- --nocapure [test name]

WASM wrapper

A WASM wrapper has been created over this repo here. The wrapper is then used to create this Typescript library which is more ergonomic than using the wrapper as the wrapper contains free floating functions.

Dependencies

~5MB
~102K SLoC