Documentation ¶
Overview ¶
Package zk provides utilities around the zkSNARK (Groth16) tooling.
Index ¶
- func BigToFF(iv *big.Int) *big.Int
- func BytesToArbo(input []byte) []*big.Int
- func BytesToArboStr(input []byte) []string
- func LittleEndianToNBytes(num *big.Int, n int) *big.Int
- func ProofToCircomSiblings(proof []byte) ([]string, error)
- func ProtobufZKProofToProverProof(p *models.ProofZkSNARK) (*prover.Proof, error)
- func ProverProofToProtobufZKProof(p *prover.Proof, electionId, sikRoot, censusRoot, nullifier types.HexBytes, ...) (*models.ProofZkSNARK, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BigToFF ¶ added in v1.9.0
BigToFF function returns the finite field representation of the big.Int provided. It uses Euclidean Modulus and the BN254 curve scalar field to represent the provided number.
func BytesToArbo ¶ added in v1.9.0
BytesToArbo calculates the sha256 hash (32 bytes) of the slice of bytes provided. Then, splits the hash into a two parts of 16 bytes, swap the endianess of that parts and encodes they into a two big.Int's.
func BytesToArboStr ¶ added in v1.4.0
BytesToArboStr function wraps BytesToArbo to return the input as []string.
func LittleEndianToNBytes ¶ added in v1.4.0
LittleEndianToNBytes truncate the most significant n bytes of the provided little endian number provided and returns into a new big.Int.
func ProofToCircomSiblings ¶ added in v1.9.0
ProofToCircomSiblings function decodes the provided proof (or packaged siblings) and and encodes any contained siblings for use in a Circom circuit.
func ProtobufZKProofToProverProof ¶ added in v1.4.0
func ProtobufZKProofToProverProof(p *models.ProofZkSNARK) (*prover.Proof, error)
ProtobufZKProofToProverProof parses the provided protobuf ready proof struct into a prover ready proof struct.
func ProverProofToProtobufZKProof ¶ added in v1.4.0
func ProverProofToProtobufZKProof(p *prover.Proof, electionId, sikRoot, censusRoot, nullifier types.HexBytes, voteWeight *big.Int) (*models.ProofZkSNARK, error)
ProverProofToProtobufZKProof encodes the proof provided into a protobuf ready struct using including the index of the circuit used. If the provided proof does not contains a defined public signals, the rest of the arguments are required to calculate that parameter. If the provided proof does not contains a defined public signals and any of the rest of the parameters is nil, the resulting struct will not contains any defined PublicInputs value.
Types ¶
This section is empty.
Directories ¶
Path | Synopsis |
---|---|
prover package abstracts the logic and types of go-rapidsnark (https://github.com/iden3/go-rapidsnark) to support basic operations for the rest of vocdoni-node project.
|
prover package abstracts the logic and types of go-rapidsnark (https://github.com/iden3/go-rapidsnark) to support basic operations for the rest of vocdoni-node project. |