package
Version:
v0.0.0-...-bb6e1c7
Opens a new window with list of versions in this module.
Published: Jan 15, 2025
License: MIT
Opens a new window with license information.
Imports: 1
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
Documentation
¶
Package field provides modular operations over very high integers.
-
type Field
-
func (f Field) Add(res, x, y *big.Int)
-
func (f Field) AreEqual(f1, f2 *big.Int) bool
-
func (f Field) ByteLen() int
-
func (f Field) CondMov(res, x, y *big.Int, b bool)
-
func (f Field) Exponent(res, x, n *big.Int) *big.Int
-
func (f Field) Inv(res, x *big.Int)
-
func (f Field) IsSquare(e *big.Int) bool
-
func (f Field) IsZero(e *big.Int) bool
-
func (f Field) LegendreSymbol(a *big.Int) *big.Int
-
func (f Field) Mod(x *big.Int) *big.Int
-
func (f Field) Mul(res, x, y *big.Int)
-
func (f Field) Neg(res, x *big.Int) *big.Int
-
func (f Field) One() *big.Int
-
func (f Field) Order() *big.Int
-
func (f Field) Sgn0(x *big.Int) uint
-
func (f Field) SqrtRatio(res, zMapConstant, e, v *big.Int) bool
-
func (f Field) Square(res, x *big.Int)
-
func (f Field) SquareRoot(res, e *big.Int) *big.Int
-
func (f Field) Sub(res, x, y *big.Int) *big.Int
-
func (f Field) Zero() *big.Int
Field represents a Galois Field.
NewField returns a newly instantiated field for the given prime order.
Add sets res to x + y modulo the field order.
AreEqual returns whether both elements are equal.
ByteLen returns the length of the field order in bytes.
CondMov sets res to y if b true, and to x otherwise.
Exponent returns x^n mod field order.
Inv sets res to the modular inverse of x mod field order.
IsSquare returns whether e is a quadratic square.
IsZero returns whether the big.Int is equivalent to zero.
LegendreSymbol applies the Legendre symbole on (a/p) and returns either {-1, 0, 1} mod field order.
Mod reduces x modulo the field order.
Mul sets res to the multiplication of x and y modulo the field order.
Neg sets res to the -x modulo the field order.
One returns one big.Int of the finite Field.
Order returns the size of the Field.
Sgn0 returns the first bit in the big-endian representation.
SqrtRatio res result to the square root of (e/v), and indicates whether (e/v) is a square.
Square sets res to the square of x modulo the field order.
SquareRoot sets res to a square root of e mod the field's order, if such a square root exists.
Sub sets res to x - y modulo the field order.
Zero returns the zero big.Int of the finite Field.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.