fptower

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const SizeOfGT = sizeOfFp * 6

SizeOfGT represents the size in bytes that a GT element need in binary form

Variables

This section is empty.

Functions

This section is empty.

Types

type E3

type E3 struct {
	A0, A1, A2 fp.Element
}

E3 is a degree-three finite field extension of fp2

func (*E3) Add

func (z *E3) Add(x, y *E3) *E3

Add adds two elements of E3

func (*E3) Clone

func (z *E3) Clone() *E3

Clone returns a copy of self

func (*E3) Conjugate

func (z *E3) Conjugate(x *E3) *E3

Conjugate conjugates an element in E3

func (*E3) Double

func (z *E3) Double(x *E3) *E3

Double doubles an element in E3

func (*E3) Equal

func (z *E3) Equal(x *E3) bool

Equal returns true if z equals x, fasle otherwise TODO can this be deleted? Should be able to use == operator instead

func (*E3) FromMont

func (z *E3) FromMont() *E3

FromMont converts from Mont form

func (*E3) Inverse

func (z *E3) Inverse(x *E3) *E3

Inverse an element in E3

func (*E3) IsZero

func (z *E3) IsZero() bool

IsZero returns true if the two elements are equal, fasle otherwise

func (*E3) Mul

func (z *E3) Mul(x, y *E3) *E3

Mul sets z to the E3-product of x,y, returns z

func (*E3) MulAssign

func (z *E3) MulAssign(x *E3) *E3

MulAssign sets z to the E3-product of z,y, returns z

func (*E3) MulBy01

func (z *E3) MulBy01(c0, c1 *fp.Element) *E3

MulBy01 multiplication by sparse element (c0,c1,0)

func (*E3) MulBy1

func (z *E3) MulBy1(c1 *fp.Element) *E3

MulBy1 multiplication of E6 by sparse element (0, c1, 0)

func (*E3) MulByElement

func (z *E3) MulByElement(x *E3, y *fp.Element) *E3

MulByElement multiplies an element in E3 by an element in fp

func (*E3) MulByNonResidue

func (z *E3) MulByNonResidue(x *E3) *E3

MulByNonResidue mul x by (0,1,0)

func (*E3) Neg

func (z *E3) Neg(x *E3) *E3

Neg negates the E3 number

func (*E3) Set

func (z *E3) Set(x *E3) *E3

Set Sets a E3 elmt form another E3 elmt

func (*E3) SetOne

func (z *E3) SetOne() *E3

SetOne sets z to 1 in Montgomery form and returns z

func (*E3) SetRandom

func (z *E3) SetRandom() (*E3, error)

SetRandom set z to a random elmt

func (*E3) SetString

func (z *E3) SetString(s1, s2, s3 string) *E3

SetString sets a E3 elmt from stringf

func (*E3) SetZero

func (z *E3) SetZero() *E3

SetZero sets an E3 elmt to zero

func (*E3) Square

func (z *E3) Square(x *E3) *E3

Square sets z to the E3-product of x,x, returns z

func (*E3) String

func (z *E3) String() string

String puts E3 elmt in string form

func (*E3) Sub

func (z *E3) Sub(x, y *E3) *E3

Sub two elements of E3

func (*E3) ToMont

func (z *E3) ToMont() *E3

ToMont converts to Mont form

type E6

type E6 struct {
	B0, B1 E3
}

E6 is a degree two finite field extension of fp3

func (*E6) Add

func (z *E6) Add(x, y *E6) *E6

Add set z=x+y in E6 and return z

func (*E6) Bytes

func (z *E6) Bytes() (r [SizeOfGT]byte)

Bytes returns the regular (non montgomery) value of z as a big-endian byte array. z.C1.B2.A1 | z.C1.B2.A0 | z.C1.B1.A1 | ...

func (*E6) Conjugate

func (z *E6) Conjugate(x *E6) *E6

Conjugate set z to x conjugated and return z

func (*E6) CyclotomicSquare

func (z *E6) CyclotomicSquare(x *E6) *E6

CyclotomicSquare https://eprint.iacr.org/2009/565.pdf, 3.2

func (*E6) Double

func (z *E6) Double(x *E6) *E6

Double sets z=2*x and returns z

func (*E6) Equal

func (z *E6) Equal(x *E6) bool

Equal returns true if z equals x, fasle otherwise

func (*E6) Exp

func (z *E6) Exp(x *E6, e big.Int) *E6

Exp sets z=x**e and returns it

func (*E6) Expt

func (z *E6) Expt(x *E6) *E6

Expt set z to x^t in E6 and return z (t is the seed of the curve)

func (*E6) Frobenius

func (z *E6) Frobenius(x *E6) *E6

Frobenius set z in E6 to Frobenius(x), return z

func (*E6) FromMont

func (z *E6) FromMont() *E6

FromMont converts from Mont form

func (*E6) Inverse

func (z *E6) Inverse(x *E6) *E6

Inverse set z to the inverse of x in E6 and return z

func (*E6) InverseUnitary

func (z *E6) InverseUnitary(x *E6) *E6

InverseUnitary inverse a unitary element

func (*E6) IsInSubGroup

func (z *E6) IsInSubGroup() bool

IsInSubGroup ensures GT/E6 is in correct sugroup

func (*E6) Mul

func (z *E6) Mul(x, y *E6) *E6

Mul set z=x*y in E6 and return z

func (*E6) MulBy014

func (z *E6) MulBy014(c0, c1, c4 *fp.Element) *E6

MulBy014 multiplication by sparse element (c0,c1,0,0,c4,0)

func (*E6) Set

func (z *E6) Set(x *E6) *E6

Set copies x into z and returns z

func (*E6) SetBytes

func (z *E6) SetBytes(e []byte) error

SetBytes interprets e as the bytes of a big-endian GT sets z to that value (in Montgomery form), and returns z. z.C1.B2.A1 | z.C1.B2.A0 | z.C1.B1.A1 | ...

func (*E6) SetOne

func (z *E6) SetOne() *E6

SetOne sets z to 1 in Montgomery form and returns z

func (*E6) SetRandom

func (z *E6) SetRandom() (*E6, error)

SetRandom used only in tests

func (*E6) SetString

func (z *E6) SetString(s0, s1, s2, s3, s4, s5 string) *E6

SetString sets a E6 from string

func (*E6) Square

func (z *E6) Square(x *E6) *E6

Square set z=x*x in E6 and return z

func (*E6) String

func (z *E6) String() string

String puts E6 in string form

func (*E6) Sub

func (z *E6) Sub(x, y *E6) *E6

Sub sets z to x sub y and return z

func (*E6) ToMont

func (z *E6) ToMont() *E6

ToMont converts to Mont form

Jump to

Keyboard shortcuts

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