utils

package
v0.0.0-...-735e08d Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2022 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Array32BigIntToHex

func Array32BigIntToHex(b [][3][2]*big.Int) [][3][2]string

func Array32BigIntToString

func Array32BigIntToString(b [][3][2]*big.Int) [][3][2]string

func Array32HexToBigInt

func Array32HexToBigInt(s [][3][2]string) ([][3][2]*big.Int, error)

[][3][2]*big.Int

func Array32StringToBigInt

func Array32StringToBigInt(s [][3][2]string) ([][3][2]*big.Int, error)

[][3][2]*big.Int

func Array3BigIntToHex

func Array3BigIntToHex(b [][3]*big.Int) [][3]string

func Array3BigIntToString

func Array3BigIntToString(b [][3]*big.Int) [][3]string

func Array3HexToBigInt

func Array3HexToBigInt(s [][3]string) ([][3]*big.Int, error)

[][3]*big.Int

func Array3StringToBigInt

func Array3StringToBigInt(s [][3]string) ([][3]*big.Int, error)

[][3]*big.Int

func ArrayArrayBigIntToHex

func ArrayArrayBigIntToHex(b [][]*big.Int) [][]string

func ArrayArrayBigIntToString

func ArrayArrayBigIntToString(b [][]*big.Int) [][]string

func ArrayArrayHexToBigInt

func ArrayArrayHexToBigInt(s [][]string) ([][]*big.Int, error)

func ArrayArrayStringToBigInt

func ArrayArrayStringToBigInt(s [][]string) ([][]*big.Int, error)

func ArrayBigIntToHex

func ArrayBigIntToHex(b []*big.Int) []string

[]*big.Int

func ArrayBigIntToString

func ArrayBigIntToString(b []*big.Int) []string

[]*big.Int

func ArrayHexToBigInt

func ArrayHexToBigInt(s []string) ([]*big.Int, error)

func ArrayStringToBigInt

func ArrayStringToBigInt(s []string) ([]*big.Int, error)

func BigInt32ToHex

func BigInt32ToHex(b [3][2]*big.Int) [3][2]string

func BigInt32ToString

func BigInt32ToString(b [3][2]*big.Int) [3][2]string

func BigInt3ToHex

func BigInt3ToHex(b [3]*big.Int) [3]string

func BigInt3ToString

func BigInt3ToString(b [3]*big.Int) [3]string

func CircuitFromHex

func CircuitFromHex(cs CircuitHex) (circuitcompiler.Circuit, error)

func CircuitFromString

func CircuitFromString(cs CircuitString) (circuitcompiler.Circuit, error)

func GrothProofFromHex

func GrothProofFromHex(s GrothProofHex) (groth16.Proof, error)

func GrothProofFromString

func GrothProofFromString(s GrothProofString) (groth16.Proof, error)

func GrothSetupFromHex

func GrothSetupFromHex(s GrothSetupHex) (groth16.Setup, error)

func GrothSetupFromString

func GrothSetupFromString(s GrothSetupString) (groth16.Setup, error)

func GrothVkFromString

func GrothVkFromString(s GrothVkString) (groth16.Vk, error)

func Hex2ToBigInt

func Hex2ToBigInt(s [2]string) ([2]*big.Int, error)

func Hex32ToBigInt

func Hex32ToBigInt(s [3][2]string) ([3][2]*big.Int, error)

[3][2]*big.Int

func Hex3ToBigInt

func Hex3ToBigInt(s [3]string) ([3]*big.Int, error)

[3]*big.Int

func ProofFromHex

func ProofFromHex(s ProofHex) (snark.Proof, error)

func ProofFromString

func ProofFromString(s ProofString) (snark.Proof, error)

func SetupFromHex

func SetupFromHex(s SetupHex) (snark.Setup, error)

func SetupFromString

func SetupFromString(s SetupString) (snark.Setup, error)

func String2ToBigInt

func String2ToBigInt(s [2]string) ([2]*big.Int, error)

func String32ToBigInt

func String32ToBigInt(s [3][2]string) ([3][2]*big.Int, error)

[3][2]*big.Int

func String3ToBigInt

func String3ToBigInt(s [3]string) ([3]*big.Int, error)

[3]*big.Int

Types

type CircuitHex

type CircuitHex struct {
	NVars         int
	NPublic       int
	NSignals      int
	PrivateInputs []string
	PublicInputs  []string
	Signals       []string
	Witness       []string
	Constraints   []circuitcompiler.Constraint
	R1CS          struct {
		A [][]string
		B [][]string
		C [][]string
	}
}

circuit

func CircuitToHex

func CircuitToHex(c circuitcompiler.Circuit) CircuitHex

type CircuitString

type CircuitString struct {
	NVars         int
	NPublic       int
	NSignals      int
	PrivateInputs []string
	PublicInputs  []string
	Signals       []string
	Witness       []string
	Constraints   []circuitcompiler.Constraint
	R1CS          struct {
		A [][]string
		B [][]string
		C [][]string
	}
}

circuit

func CircuitToString

func CircuitToString(c circuitcompiler.Circuit) CircuitString

type GrothPkHex

type GrothPkHex struct {
	BACDelta [][3]string
	Z        []string
	G1       struct {
		Alpha    [3]string
		Beta     [3]string
		Delta    [3]string
		At       [][3]string
		BACGamma [][3]string
	}
	G2 struct {
		Beta     [3][2]string
		Gamma    [3][2]string
		Delta    [3][2]string
		BACGamma [][3][2]string
	}
	PowersTauDelta [][3]string
}

groth

type GrothPkString

type GrothPkString struct {
	BACDelta [][3]string
	Z        []string
	G1       struct {
		Alpha    [3]string
		Beta     [3]string
		Delta    [3]string
		At       [][3]string
		BACGamma [][3]string
	}
	G2 struct {
		Beta     [3][2]string
		Gamma    [3][2]string
		Delta    [3][2]string
		BACGamma [][3][2]string
	}
	PowersTauDelta [][3]string
}

groth

type GrothProofHex

type GrothProofHex struct {
	PiA [3]string
	PiB [3][2]string
	PiC [3]string
}

func GrothProofToHex

func GrothProofToHex(p groth16.Proof) GrothProofHex

type GrothProofString

type GrothProofString struct {
	PiA [3]string
	PiB [3][2]string
	PiC [3]string
}

func GrothProofToString

func GrothProofToString(p groth16.Proof) GrothProofString

type GrothSetupHex

type GrothSetupHex struct {
	Pk GrothPkHex
	Vk GrothVkHex
}

func GrothSetupToHex

func GrothSetupToHex(setup groth16.Setup) GrothSetupHex

type GrothSetupString

type GrothSetupString struct {
	Pk GrothPkString
	Vk GrothVkString
}

func GrothSetupToString

func GrothSetupToString(setup groth16.Setup) GrothSetupString

type GrothVkHex

type GrothVkHex struct {
	IC [][3]string
	G1 struct {
		Alpha [3]string
	}
	G2 struct {
		Beta  [3][2]string
		Gamma [3][2]string
		Delta [3][2]string
	}
}

type GrothVkString

type GrothVkString struct {
	IC [][3]string
	G1 struct {
		Alpha [3]string
	}
	G2 struct {
		Beta  [3][2]string
		Gamma [3][2]string
		Delta [3][2]string
	}
}

type PkHex

type PkHex struct {
	G1T [][3]string
	A   [][3]string
	B   [][3][2]string
	C   [][3]string
	Kp  [][3]string
	Ap  [][3]string
	Bp  [][3]string
	Cp  [][3]string
	Z   []string
}

Setup

type ProofHex

type ProofHex struct {
	PiA  [3]string
	PiAp [3]string
	PiB  [3][2]string
	PiBp [3]string
	PiC  [3]string
	PiCp [3]string
	PiH  [3]string
	PiKp [3]string
}

Proof

func ProofToHex

func ProofToHex(p snark.Proof) ProofHex

type ProofString

type ProofString struct {
	PiA  [3]string
	PiAp [3]string
	PiB  [3][2]string
	PiBp [3]string
	PiC  [3]string
	PiCp [3]string
	PiH  [3]string
	PiKp [3]string
}

Proof

func ProofToString

func ProofToString(p snark.Proof) ProofString

type SetupHex

type SetupHex struct {
	Pk PkHex
	Vk VkHex
}

func SetupToHex

func SetupToHex(setup snark.Setup) SetupHex

type SetupString

type SetupString struct {
	// public
	Pk struct {
		G1T [][3]string
		A   [][3]string
		B   [][3][2]string
		C   [][3]string
		Kp  [][3]string
		Ap  [][3]string
		Bp  [][3]string
		Cp  [][3]string
		Z   []string
	}
	Vk struct {
		Vka   [3][2]string
		Vkb   [3]string
		Vkc   [3][2]string
		IC    [][3]string
		G1Kbg [3]string
		G2Kbg [3][2]string
		G2Kg  [3][2]string
		Vkz   [3][2]string
	}
}

Setup

func SetupToString

func SetupToString(setup snark.Setup) SetupString

type VkHex

type VkHex struct {
	Vka   [3][2]string
	Vkb   [3]string
	Vkc   [3][2]string
	IC    [][3]string
	G1Kbg [3]string
	G2Kbg [3][2]string
	G2Kg  [3][2]string
	Vkz   [3][2]string
}

Jump to

Keyboard shortcuts

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