Documentation
¶
Index ¶
- func GetBasicLogger(writer io.Writer) crypto.Logger
- func GetBasicLoggerWithLevel(writer io.Writer, level int) crypto.Logger
- func GetCurve101(fft bool) crypto.Pairing
- func GetCurve257(fft bool) crypto.Pairing
- func GetCurve97(fft bool) crypto.Pairing
- func GetR1CSForTest(t *testing.T, L, R, O [][]crypto.FieldElement) crypto.R1CSIterator
- func PrintArray(in interface{}) string
- type BigNumForTest
- func (b *BigNumForTest) Add(a1, a2 crypto.FieldElement) crypto.FieldElement
- func (b *BigNumForTest) Copy() crypto.FieldElement
- func (b *BigNumForTest) Div(a1, a2 crypto.FieldElement) crypto.FieldElement
- func (b *BigNumForTest) Double(a crypto.FieldElement) crypto.FieldElement
- func (b *BigNumForTest) Equal(element crypto.FieldElement) bool
- func (b *BigNumForTest) Exp(element crypto.FieldElement, bytes []byte) crypto.FieldElement
- func (b *BigNumForTest) From(in *big.Int) crypto.FieldElement
- func (b *BigNumForTest) FromRegular(content []byte) crypto.FieldElement
- func (b *BigNumForTest) GetModule(b2 *big.Int)
- func (b *BigNumForTest) Inv(a crypto.FieldElement) crypto.FieldElement
- func (b *BigNumForTest) IsNeg() bool
- func (b *BigNumForTest) IsOne() bool
- func (b *BigNumForTest) IsZero() bool
- func (b *BigNumForTest) MarshalJSON() ([]byte, error)
- func (b *BigNumForTest) MontBytes(bytes []byte) []byte
- func (b *BigNumForTest) Mul(a1, a2 crypto.FieldElement) crypto.FieldElement
- func (b *BigNumForTest) Neg(a crypto.FieldElement) crypto.FieldElement
- func (b *BigNumForTest) Regular(bytes []byte) []byte
- func (b *BigNumForTest) Set(element crypto.FieldElement) crypto.FieldElement
- func (b *BigNumForTest) SetInt64(u int64) crypto.FieldElement
- func (b *BigNumForTest) SetOne() crypto.FieldElement
- func (b *BigNumForTest) SetRandom(reader io.Reader) crypto.FieldElement
- func (b *BigNumForTest) SetUint64(u uint64) crypto.FieldElement
- func (b *BigNumForTest) SetZero() crypto.FieldElement
- func (b *BigNumForTest) Square(a crypto.FieldElement) crypto.FieldElement
- func (b *BigNumForTest) String() string
- func (b *BigNumForTest) Sub(a1, a2 crypto.FieldElement) crypto.FieldElement
- func (b *BigNumForTest) ToBigInt(rat *big.Int) *big.Int
- func (b *BigNumForTest) UnmarshalJSON(in []byte) error
- type CSForKeyTest
- func (C *CSForKeyTest) Compute(_ string) ([]crypto.FieldElement, error)
- func (C *CSForKeyTest) ComputeInC(cPath, info string) (wits []*big.Rat, err error)
- func (C *CSForKeyTest) ConstraintsNum() uint64
- func (C *CSForKeyTest) GetPairing() crypto.Pairing
- func (C *CSForKeyTest) GetSignalByID(nowid int) (id, reoffset int, prefix string, value crypto.FieldElement)
- func (C *CSForKeyTest) InputNum() (privateInput, publicInput int)
- func (C *CSForKeyTest) Marshal() []byte
- func (C *CSForKeyTest) Next(pos *int) (index int, a, b, c map[int]crypto.FieldElement)
- func (C *CSForKeyTest) OutputNum() int
- func (C *CSForKeyTest) SignalNum() int
- func (C *CSForKeyTest) String() string
- func (C *CSForKeyTest) Unmarshal(bytes []byte) ([]byte, error)
- type Curve
- func (c *Curve) BatchScalarMultiplicationG1(scalars []*big.Int, ret []crypto.Point)
- func (c *Curve) BatchScalarMultiplicationG2(scalars []*big.Int, ret []crypto.Point)
- func (c *Curve) GetBase(position crypto.Position) crypto.Point
- func (c *Curve) GetModule() *big.Int
- func (c *Curve) GetRootOfUnity(u uint64) (crypto.FieldElement, uint64, error)
- func (c *Curve) IsOnCurve(point crypto.Point) error
- func (c *Curve) Marshal() []byte
- func (c *Curve) Name() string
- func (c *Curve) NewCurvePoint(scalar *big.Int) *CurvePoint
- func (c *Curve) NewPoint(position crypto.Position) crypto.Point
- func (c *Curve) NewScalar() crypto.FieldElement
- func (c *Curve) NewTwistPoint(scalar *big.Int) *TwistPoint
- func (c *Curve) Pair(point []crypto.Point, point2 []crypto.Point) crypto.Point
- func (c *Curve) PairCheck(point []crypto.Point, point2 []crypto.Point) bool
- func (c *Curve) PutScalar(_ crypto.FieldElement)
- func (c *Curve) Unmarshal(data []byte) ([]byte, error)
- type CurvePoint
- func (c *CurvePoint) Add(p1 crypto.Point, p2 crypto.Point) crypto.Point
- func (c *CurvePoint) DLP() *BigNumForTest
- func (c *CurvePoint) Double(p crypto.Point) crypto.Point
- func (c *CurvePoint) GetPairing() crypto.Pairing
- func (c *CurvePoint) GetPosition() crypto.Position
- func (c *CurvePoint) IsInfinity() bool
- func (c *CurvePoint) Marshal() []byte
- func (c *CurvePoint) Neg(point crypto.Point) crypto.Point
- func (c *CurvePoint) ScalarBaseMult(e *big.Int) crypto.Point
- func (c *CurvePoint) ScalarMult(a crypto.Point, scalar *big.Int) crypto.Point
- func (c *CurvePoint) Set(p crypto.Point) crypto.Point
- func (c *CurvePoint) SetInfinity()
- func (c *CurvePoint) Unmarshal(m []byte) ([]byte, error)
- type R1csForTest
- func (r *R1csForTest) ConstraintsNum() uint64
- func (r *R1csForTest) GetSignalByID(nowid int) (id, reoffset int, prefix string, value crypto.FieldElement)
- func (r *R1csForTest) Next(pos *int) (index int, a, b, c map[int]crypto.FieldElement)
- func (r *R1csForTest) NextVariable(buf []crypto.FieldElement) (int, []crypto.FieldElement)
- type SuperLogger
- type TwistPoint
- func (t *TwistPoint) Add(p1 crypto.Point, p2 crypto.Point) crypto.Point
- func (t *TwistPoint) Double(p crypto.Point) crypto.Point
- func (t *TwistPoint) GetPairing() crypto.Pairing
- func (t *TwistPoint) GetPosition() crypto.Position
- func (t *TwistPoint) IsInfinity() bool
- func (t *TwistPoint) Marshal() []byte
- func (t *TwistPoint) Neg(point crypto.Point) crypto.Point
- func (t *TwistPoint) ScalarBaseMult(e *big.Int) crypto.Point
- func (t *TwistPoint) ScalarMult(a crypto.Point, scalar *big.Int) crypto.Point
- func (t *TwistPoint) Set(p crypto.Point) crypto.Point
- func (t *TwistPoint) SetInfinity()
- func (t *TwistPoint) Unmarshal(m []byte) ([]byte, error)
- type XBigNumForTest
- func (b *XBigNumForTest) Add(a1, a2 crypto.FieldElement) crypto.FieldElement
- func (b *XBigNumForTest) Copy() crypto.FieldElement
- func (b *XBigNumForTest) Div(a1, a2 crypto.FieldElement) crypto.FieldElement
- func (b *XBigNumForTest) Double(a crypto.FieldElement) crypto.FieldElement
- func (b *XBigNumForTest) Equal(element crypto.FieldElement) bool
- func (b *XBigNumForTest) Exp(element crypto.FieldElement, bytes []byte) crypto.FieldElement
- func (b *XBigNumForTest) From(in *big.Int) crypto.FieldElement
- func (b *XBigNumForTest) FromRegular(content []byte) crypto.FieldElement
- func (b *XBigNumForTest) GetModule(b2 *big.Int)
- func (b *XBigNumForTest) Inv(a crypto.FieldElement) crypto.FieldElement
- func (b *XBigNumForTest) IsNeg() bool
- func (b *XBigNumForTest) IsOne() bool
- func (b *XBigNumForTest) IsZero() bool
- func (b *XBigNumForTest) MarshalJSON() ([]byte, error)
- func (b *XBigNumForTest) MontBytes(res []byte) []byte
- func (b *XBigNumForTest) Mul(a1, a2 crypto.FieldElement) crypto.FieldElement
- func (b *XBigNumForTest) Neg(a crypto.FieldElement) crypto.FieldElement
- func (b *XBigNumForTest) Regular(bytes []byte) []byte
- func (b *XBigNumForTest) Set(element crypto.FieldElement) crypto.FieldElement
- func (b *XBigNumForTest) SetInt64(u int64) crypto.FieldElement
- func (b *XBigNumForTest) SetOne() crypto.FieldElement
- func (b *XBigNumForTest) SetRandom(reader io.Reader) crypto.FieldElement
- func (b *XBigNumForTest) SetUint64(u uint64) crypto.FieldElement
- func (b *XBigNumForTest) SetZero() crypto.FieldElement
- func (b *XBigNumForTest) Square(a crypto.FieldElement) crypto.FieldElement
- func (b *XBigNumForTest) String() string
- func (b *XBigNumForTest) Sub(a1, a2 crypto.FieldElement) crypto.FieldElement
- func (b *XBigNumForTest) ToBigInt(rat *big.Int) *big.Int
- func (b *XBigNumForTest) UnmarshalJSON(in []byte) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetBasicLogger ¶
GetBasicLogger get basic Logger
func GetBasicLoggerWithLevel ¶
GetBasicLoggerWithLevel get basic Logger
func GetR1CSForTest ¶
func GetR1CSForTest(t *testing.T, L, R, O [][]crypto.FieldElement) crypto.R1CSIterator
GetR1CSForTest get r1cs
Types ¶
type BigNumForTest ¶
BigNumForTest for test
func (*BigNumForTest) Add ¶
func (b *BigNumForTest) Add(a1, a2 crypto.FieldElement) crypto.FieldElement
Add add
func (*BigNumForTest) Div ¶
func (b *BigNumForTest) Div(a1, a2 crypto.FieldElement) crypto.FieldElement
Div div
func (*BigNumForTest) Double ¶
func (b *BigNumForTest) Double(a crypto.FieldElement) crypto.FieldElement
Double double
func (*BigNumForTest) Equal ¶
func (b *BigNumForTest) Equal(element crypto.FieldElement) bool
Equal reutrn bool
func (*BigNumForTest) Exp ¶
func (b *BigNumForTest) Exp(element crypto.FieldElement, bytes []byte) crypto.FieldElement
Exp exp
func (*BigNumForTest) From ¶
func (b *BigNumForTest) From(in *big.Int) crypto.FieldElement
From From
func (*BigNumForTest) FromRegular ¶
func (b *BigNumForTest) FromRegular(content []byte) crypto.FieldElement
FromRegular From regular
func (*BigNumForTest) GetModule ¶
func (b *BigNumForTest) GetModule(b2 *big.Int)
GetModule get module
func (*BigNumForTest) Inv ¶
func (b *BigNumForTest) Inv(a crypto.FieldElement) crypto.FieldElement
Inv inv
func (*BigNumForTest) MarshalJSON ¶
func (b *BigNumForTest) MarshalJSON() ([]byte, error)
MarshalJSON json.Marshaler "v@p"
func (*BigNumForTest) MontBytes ¶
func (b *BigNumForTest) MontBytes(bytes []byte) []byte
MontBytes Montgomery Byte String
func (*BigNumForTest) Mul ¶
func (b *BigNumForTest) Mul(a1, a2 crypto.FieldElement) crypto.FieldElement
Mul mul
func (*BigNumForTest) Neg ¶
func (b *BigNumForTest) Neg(a crypto.FieldElement) crypto.FieldElement
Neg neg
func (*BigNumForTest) Regular ¶
func (b *BigNumForTest) Regular(bytes []byte) []byte
Regular regular
func (*BigNumForTest) Set ¶
func (b *BigNumForTest) Set(element crypto.FieldElement) crypto.FieldElement
Set set value
func (*BigNumForTest) SetInt64 ¶
func (b *BigNumForTest) SetInt64(u int64) crypto.FieldElement
SetInt64 set int64
func (*BigNumForTest) SetRandom ¶
func (b *BigNumForTest) SetRandom(reader io.Reader) crypto.FieldElement
SetRandom set random
func (*BigNumForTest) SetUint64 ¶
func (b *BigNumForTest) SetUint64(u uint64) crypto.FieldElement
SetUint64 set uint64
func (*BigNumForTest) SetZero ¶
func (b *BigNumForTest) SetZero() crypto.FieldElement
SetZero set zero
func (*BigNumForTest) Square ¶
func (b *BigNumForTest) Square(a crypto.FieldElement) crypto.FieldElement
Square square
func (*BigNumForTest) Sub ¶
func (b *BigNumForTest) Sub(a1, a2 crypto.FieldElement) crypto.FieldElement
Sub sub
func (*BigNumForTest) ToBigInt ¶
func (b *BigNumForTest) ToBigInt(rat *big.Int) *big.Int
ToBigInt convert to big.Rat
func (*BigNumForTest) UnmarshalJSON ¶
func (b *BigNumForTest) UnmarshalJSON(in []byte) error
UnmarshalJSON json.UnMarshaler
type CSForKeyTest ¶
func (*CSForKeyTest) Compute ¶
func (C *CSForKeyTest) Compute(_ string) ([]crypto.FieldElement, error)
func (*CSForKeyTest) ComputeInC ¶
func (C *CSForKeyTest) ComputeInC(cPath, info string) (wits []*big.Rat, err error)
func (*CSForKeyTest) ConstraintsNum ¶
func (C *CSForKeyTest) ConstraintsNum() uint64
func (*CSForKeyTest) GetPairing ¶
func (C *CSForKeyTest) GetPairing() crypto.Pairing
func (*CSForKeyTest) GetSignalByID ¶
func (C *CSForKeyTest) GetSignalByID(nowid int) (id, reoffset int, prefix string, value crypto.FieldElement)
func (*CSForKeyTest) InputNum ¶
func (C *CSForKeyTest) InputNum() (privateInput, publicInput int)
func (*CSForKeyTest) Marshal ¶
func (C *CSForKeyTest) Marshal() []byte
func (*CSForKeyTest) Next ¶
func (C *CSForKeyTest) Next(pos *int) (index int, a, b, c map[int]crypto.FieldElement)
func (*CSForKeyTest) OutputNum ¶
func (C *CSForKeyTest) OutputNum() int
func (*CSForKeyTest) SignalNum ¶
func (C *CSForKeyTest) SignalNum() int
1 x out; sym1 y sym2 这个case中,x看做输出,和out看做公开输入,没有隐私输入 m=6, l=3
func (*CSForKeyTest) String ¶
func (C *CSForKeyTest) String() string
type Curve ¶
type Curve struct { SupportFFT bool Module big.Int A, B *BigNumForTest Gx, Gy *BigNumForTest Older big.Int Square big.Int G2x, G2y *XBigNumForTest }
Curve Y^2=X^3+ax+b mod Module
func (*Curve) BatchScalarMultiplicationG1 ¶
BatchScalarMultiplicationG1 batch multiplication
func (*Curve) BatchScalarMultiplicationG2 ¶
BatchScalarMultiplicationG2 batch multiplication
func (*Curve) GetRootOfUnity ¶
GetRootOfUnity 找到v阶子群的元根,v是大于u的最小的2的幂
func (*Curve) NewCurvePoint ¶
func (c *Curve) NewCurvePoint(scalar *big.Int) *CurvePoint
NewCurvePoint new curve point
func (*Curve) NewTwistPoint ¶
func (c *Curve) NewTwistPoint(scalar *big.Int) *TwistPoint
NewTwistPoint new point
func (*Curve) PutScalar ¶
func (c *Curve) PutScalar(_ crypto.FieldElement)
PutScalar put scalar to pool
type CurvePoint ¶
type CurvePoint struct { C *Curve X, Y *BigNumForTest IsInf bool Coef crypto.FieldElement }
CurvePoint point
func (*CurvePoint) GetPairing ¶
func (c *CurvePoint) GetPairing() crypto.Pairing
GetPairing get pairing
func (*CurvePoint) GetPosition ¶
func (c *CurvePoint) GetPosition() crypto.Position
GetPosition get position
func (*CurvePoint) ScalarBaseMult ¶
func (c *CurvePoint) ScalarBaseMult(e *big.Int) crypto.Point
ScalarBaseMult scalar multiplication with Base
func (*CurvePoint) ScalarMult ¶
ScalarMult scalar multiplication
type R1csForTest ¶
type R1csForTest struct {
L, R, O []map[int]crypto.FieldElement
}
R1csForTest r1cs
func (*R1csForTest) ConstraintsNum ¶
func (r *R1csForTest) ConstraintsNum() uint64
ConstraintsNum constraints number
func (*R1csForTest) GetSignalByID ¶
func (r *R1csForTest) GetSignalByID(nowid int) (id, reoffset int, prefix string, value crypto.FieldElement)
GetSignalByID get signal by ID
func (*R1csForTest) Next ¶
func (r *R1csForTest) Next(pos *int) (index int, a, b, c map[int]crypto.FieldElement)
Next next
func (*R1csForTest) NextVariable ¶
func (r *R1csForTest) NextVariable(buf []crypto.FieldElement) (int, []crypto.FieldElement)
NextVariable next Variable
type SuperLogger ¶
SuperLogger super logger
type TwistPoint ¶
type TwistPoint struct { C *Curve X, Y *XBigNumForTest IsInf bool }
TwistPoint extern point
func (*TwistPoint) GetPairing ¶
func (t *TwistPoint) GetPairing() crypto.Pairing
GetPairing get pairing
func (*TwistPoint) GetPosition ¶
func (t *TwistPoint) GetPosition() crypto.Position
GetPosition get position
func (*TwistPoint) ScalarBaseMult ¶
func (t *TwistPoint) ScalarBaseMult(e *big.Int) crypto.Point
ScalarBaseMult scalar multiplication with Base
func (*TwistPoint) ScalarMult ¶
ScalarMult scalar multiplication
type XBigNumForTest ¶
XBigNumForTest for test
func (*XBigNumForTest) Add ¶
func (b *XBigNumForTest) Add(a1, a2 crypto.FieldElement) crypto.FieldElement
Add add
func (*XBigNumForTest) Div ¶
func (b *XBigNumForTest) Div(a1, a2 crypto.FieldElement) crypto.FieldElement
Div div
func (*XBigNumForTest) Double ¶
func (b *XBigNumForTest) Double(a crypto.FieldElement) crypto.FieldElement
Double double
func (*XBigNumForTest) Equal ¶
func (b *XBigNumForTest) Equal(element crypto.FieldElement) bool
Equal is equal
func (*XBigNumForTest) Exp ¶
func (b *XBigNumForTest) Exp(element crypto.FieldElement, bytes []byte) crypto.FieldElement
Exp exp
func (*XBigNumForTest) From ¶
func (b *XBigNumForTest) From(in *big.Int) crypto.FieldElement
From parse *big.Rat
func (*XBigNumForTest) FromRegular ¶
func (b *XBigNumForTest) FromRegular(content []byte) crypto.FieldElement
FromRegular From regular
func (*XBigNumForTest) GetModule ¶
func (b *XBigNumForTest) GetModule(b2 *big.Int)
GetModule get module
func (*XBigNumForTest) Inv ¶
func (b *XBigNumForTest) Inv(a crypto.FieldElement) crypto.FieldElement
Inv inv
func (*XBigNumForTest) MarshalJSON ¶
func (b *XBigNumForTest) MarshalJSON() ([]byte, error)
MarshalJSON json.Marshaler
func (*XBigNumForTest) MontBytes ¶
func (b *XBigNumForTest) MontBytes(res []byte) []byte
MontBytes Montgomery Byte String
func (*XBigNumForTest) Mul ¶
func (b *XBigNumForTest) Mul(a1, a2 crypto.FieldElement) crypto.FieldElement
Mul (V1·V2+IS·Vi1·Vi2, V1·Vi2+V2·Vi1)
func (*XBigNumForTest) Neg ¶
func (b *XBigNumForTest) Neg(a crypto.FieldElement) crypto.FieldElement
Neg neg
func (*XBigNumForTest) Regular ¶
func (b *XBigNumForTest) Regular(bytes []byte) []byte
Regular regular
func (*XBigNumForTest) Set ¶
func (b *XBigNumForTest) Set(element crypto.FieldElement) crypto.FieldElement
Set set
func (*XBigNumForTest) SetInt64 ¶
func (b *XBigNumForTest) SetInt64(u int64) crypto.FieldElement
SetInt64 set uint64
func (*XBigNumForTest) SetOne ¶
func (b *XBigNumForTest) SetOne() crypto.FieldElement
SetOne set one
func (*XBigNumForTest) SetRandom ¶
func (b *XBigNumForTest) SetRandom(reader io.Reader) crypto.FieldElement
SetRandom set random
func (*XBigNumForTest) SetUint64 ¶
func (b *XBigNumForTest) SetUint64(u uint64) crypto.FieldElement
SetUint64 set uint64
func (*XBigNumForTest) SetZero ¶
func (b *XBigNumForTest) SetZero() crypto.FieldElement
SetZero set zero
func (*XBigNumForTest) Square ¶
func (b *XBigNumForTest) Square(a crypto.FieldElement) crypto.FieldElement
Square square
func (*XBigNumForTest) Sub ¶
func (b *XBigNumForTest) Sub(a1, a2 crypto.FieldElement) crypto.FieldElement
Sub sub
func (*XBigNumForTest) ToBigInt ¶
func (b *XBigNumForTest) ToBigInt(rat *big.Int) *big.Int
ToBigInt convert to big.Rat
func (*XBigNumForTest) UnmarshalJSON ¶
func (b *XBigNumForTest) UnmarshalJSON(in []byte) error
UnmarshalJSON json.UnMarshaler