io

package
v0.3.8 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package io offers (de)serialization APIs for gnark objects.

Unstable until v1.X.X release cycle

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PeekCurveID

func PeekCurveID(file string) (gurvy.ID, error)

PeekCurveID reads the first bytes of the file and tries to decode and return the curveID

func Read

func Read(reader io.Reader, into CurveObject) error

Read reads bytes from reader and construct object into

func ReadFile

func ReadFile(path string, into CurveObject) error

ReadFile read and deserialize input into object provided interface must be a pointer

func ReadWitness

func ReadWitness(path string, into map[string]interface{}) error

ReadWitness read and deserialize JSON file at path

returned object will contain map[string]interface{}

keys being variable names and interface{} being big.Int

big.Int values in files can be in base10 or base16 strings

func Write

func Write(writer io.Writer, from CurveObject) error

Write object from into provided writer encodes the curveID in the first bytes

func WriteFile

func WriteFile(path string, from CurveObject) error

WriteFile serialize object into file

func WriteWitness

func WriteWitness(path string, from map[string]interface{}) error

WriteWitness serialize variable map[name]value into file at path

map[string]interface{} --> interface must be convertible to big.Int using backend.FromInterface()

the resulting format is human readable (JSON)

big.Int are serialized in hexadecimal strings

Types

type CurveObject

type CurveObject interface {
	GetCurveID() gurvy.ID
}

CurveObject must know which curve they are tied to

Jump to

Keyboard shortcuts

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