circuit

package
v0.0.0-...-611ecc2 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BlockSize = fr.Bytes // BlockSize size that mimc consumes
)
View Source
const DUMMY = 10000
View Source
const MaxKeyLen = 25
View Source
const MergeLen = 31
View Source
const OneYearUnix = 31536000

Variables

This section is empty.

Functions

func CommitMiMC

func CommitMiMC(msg []byte) []byte

func EditCheckPhd

func EditCheckPhd(api frontend.API, OldRecord []frontend.Variable, NewRecord []frontend.Variable, limit PhdLimit, commitedKey frontend.Variable, oldContent PhDProfile, newContent PhDProfile, Key frontend.Variable)

func EncryptMimcFr

func EncryptMimcFr(key fr.Element, message fr.Element) fr.Element

func NBits

func NBits(field *big.Int, inputs []*big.Int, results []*big.Int) error

NBits returns the first bits of the input. The number of returned bits is defined by the length of the results slice.

func StringToAscii

func StringToAscii(input string) []int64

func Validate

func Validate(api frontend.API, content PhDProfile, record []frontend.Variable, CommittedKey frontend.Variable, Key frontend.Variable, minYearNum frontend.Variable)

Types

type Array

type Array []IsEmptyInterface // Each element is a Integer or String

type CovidLimit

type CovidLimit struct {
	VaccineTypeSet            []String
	DosageMax                 frontend.Variable
	MedicalInsuranceStatusSet []String
	CoverageMaxEndDate        Integer //vaccine can only coverage within a certain time
	Format                    []frontend.Variable
}

type CovidRecord

type CovidRecord struct {
	LatestVaccine          Vaccine
	CovidTest              []CovidTest //append only
	CovidTestNumber        String      //meet certain format
	MedicalInsuranceStatus String      //one of the Set
	CoverageEndDate        Integer     //time sensitive
}

type CovidTest

type CovidTest struct {
	TestDate Integer // time sensitive, must be increasing
	Result   String
}

func (CovidTest) IsEmpty

func (x CovidTest) IsEmpty(api frontend.API) frontend.Variable

type Dict

type Dict struct {
	// contains filtered or unexported fields
}

Each var is a UTF-8 ASCII character

type Integer

type Integer struct {
	X        frontend.Variable
	MaxDigit int
}

func (Integer) IsEmpty

func (x Integer) IsEmpty(api frontend.API) frontend.Variable

type IsEmptyInterface

type IsEmptyInterface interface {
	IsEmpty(api frontend.API) frontend.Variable
}

type MiMC

type MiMC struct {
	// contains filtered or unexported fields
}

MiMC contains the params of the Mimc hash func and the curves on which it is implemented

func NewMiMC

func NewMiMC(api frontend.API) (MiMC, error)

NewMiMC returns a MiMC instance, than can be used in a gnark circuit

func (*MiMC) Reset

func (h *MiMC) Reset()

Reset resets the Hash to its initial state.

func (*MiMC) Sum

func (h *MiMC) Sum() frontend.Variable

Hash hash (in r1cs form) using Miyaguchi–Preneel: https://en.wikipedia.org/wiki/One-way_compression_function The XOR operation is replaced by field addition. See github.com/consensys/gnark-crypto for reference implementation.

func (*MiMC) Write

func (h *MiMC) Write(data ...frontend.Variable)

Write adds more data to the running hash.

type PhDProfile

type PhDProfile struct {
	Status       String        //One of the Set
	ProgramYear  Integer       //Number within range
	StudentID    String        //meet format
	Publications []Publication //Append only
	Duration     TimeRange     //time sensitive
}

Dict

type PhdLimit

type PhdLimit struct {
	StatusSet    [4]String
	YearRange    [2]frontend.Variable //[0] lowerbound, [1] upperbound
	Format       []frontend.Variable
	TimeMinRange Integer // minimum number of year of PhD program in year
}

type Publication

type Publication struct {
	Title String
	Year  Integer
}

Dict

func (Publication) IsEmpty

func (x Publication) IsEmpty(api frontend.API) frontend.Variable

type String

type String []frontend.Variable // Each var is a UTF-8 ASCII character

func (String) IsEmpty

func (x String) IsEmpty(api frontend.API) frontend.Variable

type TimeRange

type TimeRange struct {
	Start Integer
	End   Integer
}

Dict

type Vaccine

type Vaccine struct {
	VaccineType String  // One of the Set
	Dosage      Integer // Number within range
}

Jump to

Keyboard shortcuts

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