[][src]Crate r1cs

This is a rust library for building R1CS gadgets over prime fields, which are useful in SNARKs and other argument systems.

See the readme for more information and examples.

Macros

binary_unsigned_values
boolean_values
values

Structs

BinaryExpression

A BinaryExpression is comprised of several bits, each one being a BooleanExpression. The sequence of bits is often interpreted as an unsigned integer for the purpose of binary arithmetic. When doing so, our convention is to treat the left-most bit as the least significant, and the right-most bit as the most significant.

BinaryWire

A "binary wire" which is comprised of several bits, each one being a boolean wire.

Bls12_381

The BLS12-381 curve.

Bn128

The BN128 curve.

BooleanExpression

An Expression whose value is known to be binary.

BooleanWire

A Wire whose value is constrained to be binary.

Constraint

An R1CS constraint, of the form a * b = c, where a, b, and c are linear combinations of wires.

DaviesMeyer

This is the additive variant of Davies-Meyer, which creates a one-way compression function from a block cipher.

Element

An element of a prime field.

Expression

A linear combination of wires.

Gadget
GadgetBuilder
MerkleDamgard

A hash function based on the Merkle–Damgård construction.

MerklePath

The path from a leaf to the root of a binary Merkle tree.

MiMCBlockCipher

The MiMC block cipher. This will use a number of rounds equal to round_constants.len() + 1, since the first round has no random constant.

MiMCPermutation

The MiMC permutation, which is equivalent to MiMC encryption with a key of zero.

Wire

A wire represents a witness element.

WireValues

An assignment of wire values, where each value is an element of the field F.

WitnessGenerator

Traits

BlockCipher

A symmetric-key block cipher.

CompressionFunction

A function which compresses two field elements into one, and is intended to be one-way.

Field

A prime order field.

HashFunction

A function which hashes a sequence of field elements, outputting a single field element.

MultiPermutation

A permutation of multiple field elements.

Permutation

A permutation of single field elements.