backend_bn256

package
v0.2.0-alpha Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 5, 2020 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SingleOutput solvingMethod = iota
	BinaryDec
)
View Source
const MaxOrder = 28
View Source
const RootOfUnityStr = "19103219067921713944291392827692070036145651957329286315305642004821462161904"

Variables

This section is empty.

Functions

func FFT

func FFT(a []fr.Element, w fr.Element)

FFT computes the discrete Fourier transform of a and stores the result in a. The result is in bit-reversed order. len(a) must be a power of 2, and w must be a len(a)th root of unity in field F. The algorithm is recursive, decimation-in-frequency. [cite]

Types

type Domain

type Domain struct {
	Generator        fr.Element
	GeneratorInv     fr.Element
	GeneratorSqRt    fr.Element // generator of 2 adic subgroup of order 2*nb_constraints
	GeneratorSqRtInv fr.Element
	Cardinality      int
	CardinalityInv   fr.Element
}

domain with a power of 2 cardinality compute a field element of order 2x and store it in GeneratorSqRt all other values can be derived from x, GeneratorSqrt

func NewDomain

func NewDomain(rootOfUnity fr.Element, maxOrderRoot uint, m int) *Domain

newDomain returns a subgroup with a power of 2 cardinality cardinality >= m compute a field element of order 2x and store it in GeneratorSqRt all other values can be derived from x, GeneratorSqrt

type LinearExpression

type LinearExpression []Term

LinearExpression lightweight version of linear expression

func (LinearExpression) String

func (l LinearExpression) String() string

String helper for LinearExpression

type R1C

R1C used to compute the wires (wo pointers)

func (R1C) String

func (r R1C) String() string

String helper for a Rank1 Constraint

type R1CS

type R1CS struct {
	// Wires
	NbWires        int
	NbPublicWires  int // includes ONE wire
	NbPrivateWires int
	PrivateWires   []string         // private wire names, correctly ordered (the i-th entry is the name of the (offset+)i-th wire)
	PublicWires    []string         // public wire names, correctly ordered (the i-th entry is the name of the (offset+)i-th wire)
	WireTags       map[int][]string // optional tags -- debug info

	// Constraints
	NbConstraints   int // total number of constraints
	NbCOConstraints int // number of constraints that need to be solved, the first of the Constraints slice
	Constraints     []R1C
}

R1CS decsribes a set of R1CS constraint

func Cast

func Cast(r1cs *frontend.R1CS) R1CS

Cast casts a frontend.R1CS (whose coefficients are big.Int) into a specialized R1CS whose coefficients are fr elements

func New

func New(cs *frontend.CS) R1CS

New return a typed R1CS with the curve from frontend.R1CS

func (*R1CS) Inspect

func (r1cs *R1CS) Inspect(solution backend.Assignments, showsInputs bool) (map[string]fr.Element, error)

Inspect returns the tagged variables with their corresponding value If showsInput is set, it also puts in the resulting map the inputs (public and private).

func (*R1CS) Solve

func (r1cs *R1CS) Solve(assignment backend.Assignments, a, b, c, wireValues []fr.Element) error

Solve sets all the wires and returns the a, b, c vectors. the r1cs system should have been compiled before. The entries in a, b, c are in Montgomery form. assignment: map[string]value: contains the input variables a, b, c vectors: ab-c = hz wireValues = [intermediateVariables | privateInputs | publicInputs]

func (*R1CS) Write

func (r1cs *R1CS) Write(path string) error

type Term

type Term struct {
	ID    int64      // index of the constraint used to compute this wire
	Coeff fr.Element // coefficient by which the wire is multiplied
}

Term lightweight version of a term, no pointers

func (Term) String

func (t Term) String() string

String helper for Term

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL