Documentation
¶
Overview ¶
Package config provides Golang code generation for efficient field arithmetic operations.
Index ¶
- func CoordNameForExtensionDegree(degree uint8) string
- func NewElement(s []string) []big.Int
- type Assembly
- type Element
- type Extension
- func (f *Extension) Add(x Element, y Element) Element
- func (f *Extension) Div(u, v Element) Element
- func (f *Extension) Equal(x Element, y Element) bool
- func (f *Extension) Exp(x Element, exp *big.Int) Element
- func (f *Extension) FromInt64(i ...int64) Element
- func (f *Extension) Halve(z Element)
- func (f *Extension) Inverse(x Element) Element
- func (f *Extension) IsZero(u Element) bool
- func (f *Extension) Mul(x Element, y Element) Element
- func (f *Extension) MulScalar(c *big.Int, x Element) Element
- func (f *Extension) Neg(x Element) Element
- func (f *Extension) Sqrt(x Element) Element
- func (f *Extension) ToMont(x Element) Element
- type FFT
- type Field
- func (f *Field) Add(z *big.Int, x *big.Int, y *big.Int) *Field
- func (f *Field) Exp(res *big.Int, x *big.Int, pow *big.Int) *Field
- func (f *Field) FromMont(nonMont *big.Int, mont *big.Int) *Field
- func (f *Field) Mul(z *big.Int, x *big.Int, y *big.Int) *Field
- func (f *Field) StringToMont(str string) big.Int
- func (f *Field) ToMont(nonMont big.Int) big.Int
- func (f *Field) ToMontSlice(x []big.Int) []big.Int
- func (f *Field) WriteElement(element Element) string
- type Word
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CoordNameForExtensionDegree ¶
TODO: Spaghetti Alert: Okay to have codegen functions here?
func NewElement ¶
Types ¶
type Extension ¶
type Extension struct { Base *Field //Fp Size big.Int //q Degree int //n such that q = pⁿ TODO: Make uint8 so forced to be positive and small RootOf int64 //α }
Extension is a simple radical extension, obtained by adjoining ⁿ√α to Fp
type FFT ¶ added in v0.15.0
type FFT struct { // TODO this should be in the finite field package API GeneratorFullMultiplicativeGroup uint64 // generator of \mathbb{F}_r^{*} // TODO should be generated by goff GeneratorMaxTwoAdicSubgroup string // generator of the maximum subgroup of size 2^<something> // TODO should be generated by goff LogTwoOrderMaxTwoAdicSubgroup string // log_2 of the max order of the max two adic subgroup }
type Field ¶ added in v0.15.0
type Field struct { PackageName string ElementName string ModulusBig *big.Int Modulus string ModulusHex string NbWords int NbBits int NbBytes int NbWordsLastIndex int NbWordsIndexesNoZero []int NbWordsIndexesFull []int P20InversionCorrectiveFac []uint64 P20InversionNbIterations int UsingP20Inverse bool IsMSWSaturated bool // indicates if the most significant word is 0xFFFFF...FFFF Q []uint64 QInverse []uint64 QMinusOneHalvedP []uint64 // ((q-1) / 2 ) + 1 Mu uint64 // mu = 2^288 / q for 4.5 word barrett reduction RSquare []uint64 One, Thirteen []uint64 LegendreExponent string // big.Int to base16 string NoCarry bool NoCarrySquare bool // used if NoCarry is set, but some op may overflow in square optimization SqrtQ3Mod4 bool SqrtAtkin bool SqrtTonelliShanks bool SqrtE uint64 SqrtS []uint64 SqrtAtkinExponent string // big.Int to base16 string SqrtSMinusOneOver2 string // big.Int to base16 string SqrtQ3Mod4Exponent string // big.Int to base16 string SqrtG []uint64 // NonResidue ^ SqrtR (montgomery form) NonResidue big.Int // (montgomery form) LegendreExponentData *addchain.AddChainData SqrtAtkinExponentData *addchain.AddChainData SqrtSMinusOneOver2Data *addchain.AddChainData SqrtQ3Mod4ExponentData *addchain.AddChainData UseAddChain bool Word Word // 32 iff Q < 2^32, else 64 F31 bool // 31 bits field // asm code generation GenerateOpsAMD64 bool GenerateOpsARM64 bool GenerateVectorOpsAMD64 bool GenerateVectorOpsARM64 bool ASMPackagePath string }
Field precomputed values used in template for code generation of field element APIs
func NewFieldConfig ¶
NewFieldConfig returns a data structure with needed information to generate apis for field element
See field/generator package
func (*Field) StringToMont ¶ added in v0.15.0
StringToMont takes an element written in string form, and returns it in Montgomery form Useful for hard-coding in implementation field elements from standards documents
func (*Field) WriteElement ¶ added in v0.15.0
Click to show internal directories.
Click to hide internal directories.