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§
pub use num;
Macros§
- binary_
unsigned_ values - Creates an instance of
WireValues
from the given binary wires andBigUint
values. - boolean_
values - Creates an instance of
WireValues
from the given boolean wires and boolean values. - values
- Creates an instance of
WireValues
from the given wires and field element values.
Structs§
- Binary
Expression - A
BinaryExpression
is comprised of several bits, each one being aBooleanExpression
. - Binary
Wire - 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.
- Boolean
Expression - An
Expression
whose value is known to be binary. - Boolean
Wire - A
Wire
whose value is constrained to be binary. - Constraint
- An rank-1 constraint of the form a * b = c, where a, b, and c are linear combinations of wires.
- Davies
Meyer - The additive variant of Davies-Meyer, which creates a one-way compression function from a block cipher.
- Edwards
Point - An embedded Edwards curve point defined over the same base field as the constraint system, with affine coordinates as elements.
- Edwards
Point Expression - An embedded Edwards curve point defined over the same base field as the field used in the constraint system, with affine coordinates as expressions.
- Element
- An element of a prime field.
- Element
Matrix - A matrix of prime field elements.
- Expression
- A linear combination of wires.
- Gadget
- An R1CS gadget.
- Gadget
Builder - Inverse
Permutation - The permutation
1 / x
, with zero being mapped to itself. - JubJub
- LCG
- A simple linear congruential generator, with parameters taken from Numerical Recipes.
- MdsMatrix
- A Maximum Distance Separable matrix.
- Merkle
Damgard - A hash function based on the Merkle–Damgård construction.
- Merkle
Path - The path from a leaf to the root of a binary Merkle tree.
- MiMC
Block Cipher - The MiMC block cipher.
- MiMC
Permutation - The MiMC permutation, which is equivalent to MiMC encryption with a key of zero.
- Miyaguchi
Preneel - The additive variant of Miyaguchi-Preneel, which creates a one-way compression function from a block cipher.
- Monomial
Permutation - The permutation
x^n
. - Montgomery
Point Expression - An embedded Montgomery curve point defined over the same base field as the field used in the constraint system, with affine coordinates as expressions.
- Number
OfRounds - The number of full and partial rounds to use in an instance of Poseidon.
- Poseidon
- The Poseidon permutation.
- Poseidon
Builder - Builds a
Poseidon
instance. - Proj
Weierstrass Point Expression - An embedded Weierstrass curve point defined over the same base field as the field used in the constraint system, with projective coordinates as expressions.
- Rescue
- The Rescue permutation.
- Rescue
Builder - Builds a
Rescue
instance. - Sponge
- A sponge function.
- Weierstrass
Point Expression - An embedded Weierstrass curve point defined over the same base field as the field used in the constraint system, with affine coordinates as expressions.
- Wire
- A wire represents a witness element.
- Wire
Values - An assignment of wire values, where each value is an element of the field
F
. - Witness
Generator - Generates some elements of the witness.
Enums§
- Poseidon
Sbox - An S-Box that can be used with Poseidon.
Traits§
- Block
Cipher - A symmetric-key block cipher.
- Compression
Function - A function which compresses two field elements into one, and is intended to be one-way.
- Curve
- Curve
Point - Edwards
Curve - An embedded twisted Edwards curve defined over the same base field as the field used in the constraint system
- Field
- A prime order field.
- Hash
Function - A function which hashes a sequence of field elements, outputting a single field element.
- Multi
Permutation - A permutation whose inputs and outputs consist of multiple field elements.
- Permutation
- A permutation of single field elements.