emulated

package
v0.0.0-...-51639b7 Latest Latest
Warning

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

Go to latest
Published: May 4, 2023 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DivHint

func DivHint(mod *big.Int, inputs []*big.Int, outputs []*big.Int) error

DivHint computes the value z = x/y for inputs x and y and stores z in outputs.

func GetHints

func GetHints() []solver.Hint

GetHints returns all hint functions used in the package.

func InverseHint

func InverseHint(mod *big.Int, inputs []*big.Int, outputs []*big.Int) error

InverseHint computes the inverse x^-1 for the input x and stores it in outputs.

func MultiplicationHint

func MultiplicationHint(mod *big.Int, inputs []*big.Int, outputs []*big.Int) error

MultiplicationHint unpacks the factors and parameters from inputs, computes the product and stores it in output. See internal method computeMultiplicationHint for the input packing.

func QuoHint

func QuoHint(_ *big.Int, inputs []*big.Int, outputs []*big.Int) error

QuoHint sets z to the quotient x/y for y != 0 and returns z. If y == 0, returns an error. Quo implements truncated division (like Go); see QuoRem for more details.

func RemHint

func RemHint(_ *big.Int, inputs []*big.Int, outputs []*big.Int) error

RemHint sets z to the remainder x%y for y != 0 and returns z. If y == 0, returns an error. Rem implements truncated modulus (like Go); see QuoRem for more details.

func RightShift

func RightShift(_ *big.Int, inputs []*big.Int, outputs []*big.Int) error

RightShift shifts input by the given number of bits. Expects two inputs:

  • first input is the shift, will be represented as uint64;
  • second input is the value to be shifted.

Returns a single output which is the value shifted. Errors if number of inputs is not 2 and number of outputs is not 1.

Types

type BLS12377Fp

type BLS12377Fp struct{}

BLS12377Fp provide type parametrization for emulated field on 6 limb of width 64bits for modulus 0x1ae3a4617c510eac63b05c06ca1493b1a22d9f300f5138f1ef3622fba094800170b5d44300000008508c00000000001. This is the base field of the BLS12-377 curve.

func (BLS12377Fp) BitsPerLimb

func (fp BLS12377Fp) BitsPerLimb() uint

func (BLS12377Fp) IsPrime

func (fp BLS12377Fp) IsPrime() bool

func (BLS12377Fp) Modulus

func (fp BLS12377Fp) Modulus() *big.Int

func (BLS12377Fp) NbLimbs

func (fp BLS12377Fp) NbLimbs() uint

type BN254Fp

type BN254Fp struct{}

BN254Fp provide type parametrization for emulated field on 4 limb of width 64bits for modulus 0x30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd47. This is the base field of the BN254 curve.

func (BN254Fp) BitsPerLimb

func (fp BN254Fp) BitsPerLimb() uint

func (BN254Fp) IsPrime

func (fp BN254Fp) IsPrime() bool

func (BN254Fp) Modulus

func (fp BN254Fp) Modulus() *big.Int

func (BN254Fp) NbLimbs

func (fp BN254Fp) NbLimbs() uint

type BN254Fr

type BN254Fr struct{}

BN254Fr provides type parametrisation for emulated field on 4 limbs of width 64bits for modulus 0x30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000001. This is the scalar field of the BN254 curve.

func (BN254Fr) BitsPerLimb

func (fp BN254Fr) BitsPerLimb() uint

func (BN254Fr) IsPrime

func (fp BN254Fr) IsPrime() bool

func (BN254Fr) Modulus

func (fp BN254Fr) Modulus() *big.Int

func (BN254Fr) NbLimbs

func (fp BN254Fr) NbLimbs() uint

type FieldParams

type FieldParams interface {
	NbLimbs() uint     // number of limbs to represent field element
	BitsPerLimb() uint // number of bits per limb. Top limb may contain less than limbSize bits.
	IsPrime() bool     // indicates if the modulus is prime
	Modulus() *big.Int // returns modulus. Do not modify.
}

FieldParams describes the emulated field characteristics

type Goldilocks

type Goldilocks struct{}

Goldilocks provide type parametrization for emulated field on 1 limb of width 64bits for modulus 0xffffffff00000001

func (Goldilocks) BitsPerLimb

func (fp Goldilocks) BitsPerLimb() uint

func (Goldilocks) IsPrime

func (fp Goldilocks) IsPrime() bool

func (Goldilocks) Modulus

func (fp Goldilocks) Modulus() *big.Int

func (Goldilocks) NbLimbs

func (fp Goldilocks) NbLimbs() uint

type Secp256k1Fp

type Secp256k1Fp struct{}

Secp256k1Fp provide type parametrization for emulated field on 4 limb of width 64bits for modulus 0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f. This is the base field of secp256k1 curve

func (Secp256k1Fp) BitsPerLimb

func (fp Secp256k1Fp) BitsPerLimb() uint

func (Secp256k1Fp) IsPrime

func (fp Secp256k1Fp) IsPrime() bool

func (Secp256k1Fp) Modulus

func (fp Secp256k1Fp) Modulus() *big.Int

func (Secp256k1Fp) NbLimbs

func (fp Secp256k1Fp) NbLimbs() uint

type Secp256k1Fr

type Secp256k1Fr struct{}

Secp256k1Fr provides type parametrization for emulated field on 4 limbs of width 64bits for modulus 0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141. This is the scalar field of secp256k1 curve.

func (Secp256k1Fr) BitsPerLimb

func (fp Secp256k1Fr) BitsPerLimb() uint

func (Secp256k1Fr) IsPrime

func (fp Secp256k1Fr) IsPrime() bool

func (Secp256k1Fr) Modulus

func (fp Secp256k1Fr) Modulus() *big.Int

func (Secp256k1Fr) NbLimbs

func (fp Secp256k1Fr) NbLimbs() uint

Jump to

Keyboard shortcuts

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