fp448

package
v0.0.0-...-ac9c40d Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2024 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Overview

Package fp448 provides prime field arithmetic over GF(2^448-2^224-1).

Index

Constants

View Source
const Size = 56

Size in bytes of an element.

Variables

This section is empty.

Functions

func Add

func Add(z, x, y *Elt)

Add calculates z = x+y mod p.

func AddSub

func AddSub(x, y *Elt)

AddSub calculates (x,y) = (x+y mod p, x-y mod p).

func Cmov

func Cmov(x, y *Elt, n uint)

Cmov assigns y to x if n is 1.

func Cswap

func Cswap(x, y *Elt, n uint)

Cswap interchanges x and y if n is 1.

func Inv

func Inv(z, x *Elt)

Inv calculates z = 1/x mod p.

func InvSqrt

func InvSqrt(z, x, y *Elt) (isQR bool)

InvSqrt calculates z = sqrt(x/y) iff x/y is a quadratic-residue. If so, isQR = true; otherwise, isQR = false, since x/y is a quadratic non-residue, and z = sqrt(-x/y).

func IsOne

func IsOne(x *Elt) bool

IsOne returns true if x is equal to 1.

func IsZero

func IsZero(x *Elt) bool

IsZero returns true if x is equal to 0.

func Modp

func Modp(z *Elt)

Modp ensures that z is between [0,p-1].

func Mul

func Mul(z, x, y *Elt)

Mul calculates z = x*y mod p.

func Neg

func Neg(z, x *Elt)

Neg calculates z = -x.

func SetOne

func SetOne(x *Elt)

SetOne assigns x=1.

func Sqr

func Sqr(z, x *Elt)

Sqr calculates z = x^2 mod p.

func Sub

func Sub(z, x, y *Elt)

Sub calculates z = x-y mod p.

func ToBytes

func ToBytes(b []byte, x *Elt) error

ToBytes stores in b the little-endian byte representation of x.

Types

type Elt

type Elt [Size]byte

Elt is a prime field element.

func One

func One() (x Elt)

One returns the 1 element.

func P

func P() Elt

P returns the prime modulus 2^448-2^224-1.

func (Elt) String

func (e Elt) String() string

Jump to

Keyboard shortcuts

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