...

Package fp448

import "github.com/cloudflare/circl/math/fp448"
Overview
Index

Overview ▾

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

Constants

Size in bytes of an element.

const Size = 56

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.

type Elt

Elt is a prime field element.

type Elt [Size]byte

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