field

package
v1.0.5003 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Element

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

Element is an integer modulo 2^256 - 2^224 - 2^96 + 2^64 - 1.

The zero value is a valid zero element.

func (*Element) Add

func (e *Element) Add(t1, t2 *Element) *Element

Add sets e = t1 + t2, and returns e.

func (*Element) Bytes

func (e *Element) Bytes() []byte

Bytes returns the 32-byte big-endian encoding of e.

func (*Element) Equal

func (e *Element) Equal(t *Element) int

Equal returns 1 if e == t, and zero otherwise.

func (*Element) Invert

func (e *Element) Invert(x *Element) *Element

Invert sets e = 1/x, and returns e.

If x == 0, Invert returns e = 0.

func (*Element) IsZero

func (e *Element) IsZero() int

IsZero returns 1 if e == 0, and zero otherwise.

func (*Element) Mul

func (e *Element) Mul(t1, t2 *Element) *Element

Mul sets e = t1 * t2, and returns e.

func (*Element) One

func (e *Element) One() *Element

One sets e = 1, and returns e.

func (*Element) Select

func (v *Element) Select(a, b *Element, cond int) *Element

Select sets v to a if cond == 1, and to b if cond == 0.

func (*Element) Set

func (e *Element) Set(t *Element) *Element

Set sets e = t, and returns e.

func (*Element) SetBytes

func (e *Element) SetBytes(v []byte) (*Element, error)

SetBytes sets e = v, where v is a big-endian 32-byte encoding, and returns e. If v is not 32 bytes or it encodes a value higher than 2^256 - 2^224 - 2^96 + 2^64 - 1, SetBytes returns nil and an error, and e is unchanged.

func (*Element) Square

func (e *Element) Square(t *Element) *Element

Square sets e = t * t, and returns e.

func (*Element) Sub

func (e *Element) Sub(t1, t2 *Element) *Element

Sub sets e = t1 - t2, and returns e.

type OrderElement

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

OrderElement is an integer modulo 0xFFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFF7203DF6B21C6052B53BBF40939D54123.

The zero value is a valid zero element.

func (*OrderElement) Add

func (e *OrderElement) Add(t1, t2 *OrderElement) *OrderElement

Add sets e = t1 + t2, and returns e.

func (*OrderElement) Bytes

func (e *OrderElement) Bytes() []byte

Bytes returns the 32-byte big-endian encoding of e.

func (*OrderElement) Mul

func (e *OrderElement) Mul(t1, t2 *OrderElement) *OrderElement

Mul sets e = t1 * t2, and returns e.

func (*OrderElement) One

func (e *OrderElement) One() *OrderElement

One sets e = 1, and returns e.

func (*OrderElement) Select

func (v *OrderElement) Select(a, b *OrderElement, cond int) *OrderElement

Select sets v to a if cond == 1, and to b if cond == 0.

func (*OrderElement) SetBytes

func (e *OrderElement) SetBytes(v []byte) (*OrderElement, error)

SetBytes sets e = v, where v is a big-endian 32-byte encoding, and returns e. If v is not 32 bytes or it encodes a value higher than 2^256 - 2^224 - 2^96 + 2^64 - 1, SetBytes returns nil and an error, and e is unchanged.

func (*OrderElement) Square

func (e *OrderElement) Square(t *OrderElement) *OrderElement

Square sets e = t * t, and returns e.

func (*OrderElement) Sub

func (e *OrderElement) Sub(t1, t2 *OrderElement) *OrderElement

Sub sets e = t1 - t2, and returns e.

Jump to

Keyboard shortcuts

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