field

package
v1.0.2066 Latest Latest
Warning

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

Go to latest
Published: May 9, 2024 License: Apache-2.0 Imports: 1 Imported by: 1

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 represents an element of the field GF(2^448-2^224-1). Note that this is not a cryptographically secure group

This type works similarly to math/big.Int, and all arguments and receivers are allowed to alias.

The zero value is a valid zero element.

func (*Element) Abs

func (v *Element) Abs(u *Element) *Element

func (*Element) Add

func (v *Element) Add(a, b *Element) *Element

Add sets v = a + b, and returns v.

func (*Element) Bytes

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

func (*Element) Equal

func (v *Element) Equal(u *Element) int

Equal returns 1 if v and u are equal, and 0 otherwise.

func (*Element) Inv

func (v *Element) Inv(z *Element) *Element

Inv sets v = 1/z mod p, and returns v.

func (*Element) IsNegative

func (v *Element) IsNegative() int

IsNegative returns 1 if v is negative, and 0 otherwise.

func (*Element) Mul

func (v *Element) Mul(a, b *Element) *Element

func (*Element) Mul32

func (v *Element) Mul32(x *Element, y uint32) *Element

func (*Element) Negate

func (v *Element) Negate(a *Element) *Element

Negate sets v = -a, and returns v.

func (*Element) One

func (v *Element) One() *Element

One sets v = 1, and returns v.

func (*Element) Power446

func (v *Element) Power446(z *Element) *Element

Power446 sets v = v ^ ((p-3)/4) mod p, and returns v. (p-3)/4 is 2^446 - 2^222 - 1.

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 (v *Element) Set(a *Element) *Element

Set sets v = a, and returns v.

func (*Element) SetBytes

func (v *Element) SetBytes(x []byte) *Element

SetBytes sets v to x, which must be a 56-byte little-endian encoding.

func (*Element) SqrtRatio

func (r *Element) SqrtRatio(u, v *Element) (rr *Element, wasSquare int)

SqrtRatio sets r to the non-negative square root of the ratio of u and v.

If u/v is square, SqrtRatio returns r and 1. If u/v is not square, SqrtRatio sets r according to Section 5.2 of draft-irtf-cfrg-ristretto255-decaf448-04, and returns r and 0.

func (*Element) Square

func (v *Element) Square(a *Element) *Element

func (*Element) Sub

func (v *Element) Sub(a, b *Element) *Element

Subtract sets v = a - b, and returns v.

func (*Element) Swap

func (v *Element) Swap(u *Element, cond int)

Swap swaps v and u if cond == 1 or leaves them unchanged if cond == 0.

func (*Element) Zero

func (v *Element) Zero() *Element

Zero sets v = 0, and returns v.

Jump to

Keyboard shortcuts

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