Crate r1cs

Source
Expand description

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.

Re-exports§

Macros§

  • Creates an instance of WireValues from the given binary wires and BigUint values.
  • Creates an instance of WireValues from the given boolean wires and boolean values.
  • Creates an instance of WireValues from the given wires and field element values.

Structs§

  • A BinaryExpression is comprised of several bits, each one being a BooleanExpression.
  • A “binary wire” which is comprised of several bits, each one being a boolean wire.
  • The BLS12-381 curve.
  • The BN128 curve.
  • An Expression whose value is known to be binary.
  • A Wire whose value is constrained to be binary.
  • An rank-1 constraint of the form a * b = c, where a, b, and c are linear combinations of wires.
  • The additive variant of Davies-Meyer, which creates a one-way compression function from a block cipher.
  • An embedded Edwards curve point defined over the same base field as the constraint system, with affine coordinates as elements.
  • An embedded Edwards curve point defined over the same base field as the field used in the constraint system, with affine coordinates as expressions.
  • An element of a prime field.
  • A matrix of prime field elements.
  • A linear combination of wires.
  • An R1CS gadget.
  • The permutation 1 / x, with zero being mapped to itself.
  • A simple linear congruential generator, with parameters taken from Numerical Recipes.
  • A Maximum Distance Separable matrix.
  • A hash function based on the Merkle–Damgård construction.
  • The path from a leaf to the root of a binary Merkle tree.
  • The MiMC block cipher.
  • The MiMC permutation, which is equivalent to MiMC encryption with a key of zero.
  • The additive variant of Miyaguchi-Preneel, which creates a one-way compression function from a block cipher.
  • The permutation x^n.
  • An embedded Montgomery curve point defined over the same base field as the field used in the constraint system, with affine coordinates as expressions.
  • The number of full and partial rounds to use in an instance of Poseidon.
  • The Poseidon permutation.
  • Builds a Poseidon instance.
  • An embedded Weierstrass curve point defined over the same base field as the field used in the constraint system, with projective coordinates as expressions.
  • The Rescue permutation.
  • Builds a Rescue instance.
  • A sponge function.
  • An embedded Weierstrass curve point defined over the same base field as the field used in the constraint system, with affine coordinates as expressions.
  • A wire represents a witness element.
  • An assignment of wire values, where each value is an element of the field F.
  • Generates some elements of the witness.

Enums§

Traits§

  • A symmetric-key block cipher.
  • A function which compresses two field elements into one, and is intended to be one-way.
  • An embedded twisted Edwards curve defined over the same base field as the field used in the constraint system
  • A prime order field.
  • A function which hashes a sequence of field elements, outputting a single field element.
  • A permutation whose inputs and outputs consist of multiple field elements.
  • A permutation of single field elements.