parsers

package
v0.0.0-...-1c2a880 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2021 License: GPL-3.0 Imports: 14 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ArrayBigIntToString

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

ArrayBigIntToString converts an []*big.Int into []string, used to output the Public Signals

func ParsePk

func ParsePk(pkJSON []byte) (*types.Pk, error)

ParsePk parses the json []byte data into the Pk struct

func ParsePkBin

func ParsePkBin(f *os.File) (*types.Pk, error)

ParsePkBin parses binary file representation of the ProvingKey into the ProvingKey struct

func ParsePkGoBin

func ParsePkGoBin(f *os.File) (*types.Pk, error)

ParsePkGoBin parses go-snark binary file representation of the ProvingKey into ProvingKey struct (*types.Pk). PkGoBin is a own go-snark binary format that allows to go faster when parsing.

func ParseProof

func ParseProof(pj []byte) (*types.Proof, error)

ParseProof takes a json []byte and outputs the *Proof struct

func ParsePublicSignals

func ParsePublicSignals(pj []byte) ([]*big.Int, error)

ParsePublicSignals takes a json []byte and outputs the []*big.Int struct

func ParseVk

func ParseVk(vj []byte) (*types.Vk, error)

ParseVk takes a json []byte and outputs the *Vk struct

func ParseWitness

func ParseWitness(wJSON []byte) (types.Witness, error)

ParseWitness parses the json []byte data into the Witness struct

func ParseWitnessBin

func ParseWitnessBin(f *os.File) (types.Witness, error)

ParseWitnessBin parses binary file representation of the Witness into the Witness struct

func PkToGoBin

func PkToGoBin(pk *types.Pk) ([]byte, error)

PkToGoBin converts the ProvingKey (*types.Pk) into binary format defined by go-snark. PkGoBin is a own go-snark binary format that allows to go faster when parsing. nolint:gomnd

func ProofToJSON

func ProofToJSON(p *types.Proof) ([]byte, error)

ProofToJSON outputs the Proof i JSON format

func ProofToJSONHex

func ProofToJSONHex(p *types.Proof) ([]byte, error)

ProofToJSONHex outputs the Proof i JSON format with hexadecimal strings

Types

type PkString

type PkString struct {
	A          [][]string          `json:"A"`
	B2         [][][]string        `json:"B2"`
	B1         [][]string          `json:"B1"`
	C          [][]string          `json:"C"`
	NVars      int                 `json:"nVars"`
	NPublic    int                 `json:"nPublic"`
	VkAlpha1   []string            `json:"vk_alpha_1"`
	VkDelta1   []string            `json:"vk_delta_1"`
	VkBeta1    []string            `json:"vk_beta_1"`
	VkBeta2    [][]string          `json:"vk_beta_2"`
	VkDelta2   [][]string          `json:"vk_delta_2"`
	HExps      [][]string          `json:"hExps"`
	DomainSize int                 `json:"domainSize"`
	PolsA      []map[string]string `json:"polsA"`
	PolsB      []map[string]string `json:"polsB"`
}

PkString is the equivalent to the Pk struct in string representation, containing the ProvingKey

type ProofString

type ProofString struct {
	A        []string   `json:"pi_a"`
	B        [][]string `json:"pi_b"`
	C        []string   `json:"pi_c"`
	Protocol string     `json:"protocol"`
}

ProofString is the equivalent to the Proof struct in string representation

func ProofStringToSmartContractFormat

func ProofStringToSmartContractFormat(s ProofString) ProofString

ProofStringToSmartContractFormat converts the ProofString to a ProofString in the SmartContract format in a ProofString structure

func ProofToHex

func ProofToHex(p *types.Proof) ProofString

ProofToHex converts the Proof to ProofString with hexadecimal strings

func ProofToSmartContractFormat

func ProofToSmartContractFormat(p *types.Proof) ProofString

ProofToSmartContractFormat converts the *types.Proof to a ProofString in the SmartContract format in a ProofString structure

func ProofToString

func ProofToString(p *types.Proof) ProofString

ProofToString converts the Proof to ProofString

type VkString

type VkString struct {
	Alpha []string   `json:"vk_alpha_1"`
	Beta  [][]string `json:"vk_beta_2"`
	Gamma [][]string `json:"vk_gamma_2"`
	Delta [][]string `json:"vk_delta_2"`
	IC    [][]string `json:"IC"`
}

VkString is the Verification Key data structure in string format (from json)

type WitnessString

type WitnessString []string

WitnessString contains the Witness in string representation

Jump to

Keyboard shortcuts

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