fq

package
v0.0.0-...-95aab37 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2021 License: MIT Imports: 3 Imported by: 2

Documentation

Index

Constants

View Source
const INV uint64 = 0xfffffffeffffffff

INV = -(q^{-1} mod 2^64) mod 2^64

View Source
const S int = 32

Variables

View Source
var D = Fq{0x2a522455b974f6b0, 0xfc6cc9ef0d9acab3, 0x7a08fb94c27628d1, 0x57f8f6a8fe0e262e}

D = -(10240/10241)

View Source
var D2 = Fq{0x54a448ac72e9ed5f, 0xa51befdb1b373967, 0xc0d81f217b4a799e, 0x3c0445fed27ecf14}

D2 = 2 * d

View Source
var EDWARDS_D = Fq{
	0x0106_5fd6_d634_3eb1,
	0x292d_7f6d_3757_9d26,
	0xf5fd_9207_e6bd_7fd4,
	0x2a93_18e7_4bfa_2b48,
}

`d = -(10240/10241)`

View Source
var EDWARDS_D2 = Fq{
	0x020c_bfad_ac68_7d62,
	0x525a_feda_6eaf_3a4c,
	0xebfb_240f_cd7a_ffa8,
	0x5526_31ce_97f4_5691,
}

`2*d`

View Source
var R = Fq{0x00000001fffffffe, 0x5884b7fa00034802, 0x998c4fefecbc4ff5, 0x1824b159acc5056f}

R = 2^256 mod q

View Source
var R2 = Fq{0xc999e990f3f29c6d, 0x2b6cedcb87925c23, 0x05d314967254398f, 0x0748d9d99f59ff11}

R2 = 2^512 mod q

View Source
var R3 = Fq{0xc62c1807439b73af, 0x1b3e0d188cf06990, 0x73d13c71c7b5f418, 0x6e2a5bb9c8db33e9}

R3 = R2 * 2^256 mod q = 2^768 mod q

View Source
var ROOTOFUNITY = Fq{0xb9b58d8c5f0e466a, 0x5b1b4c801819d7ec, 0x0af53ae352a31e64, 0x5bf3adda19e9b27b}

ROOTOFUNITY GENERATOR^t where t * 2^s + 1 = q with t odd.

Functions

This section is empty.

Types

type Fq

type Fq [4]uint64

func ConditionalSelect

func ConditionalSelect(a, b *Fq, choice int) *Fq

func FromBytes

func FromBytes(byt []byte) *Fq

from_bytes

func FromRaw

func FromRaw(f *Fq) *Fq

func One

func One() *Fq

One sets f to the one element

func Set

func Set(q *Fq) *Fq

func Zero

func Zero() *Fq

Zero sets f to the zero element

func (*Fq) Add

func (lhs *Fq) Add(rhs *Fq) *Fq

Add Adds one field to another

func (*Fq) Bytes

func (f *Fq) Bytes() []byte

BytesInto converts f into a little endian byte slice

func (*Fq) Double

func (f *Fq) Double() *Fq

Double doubles f by adding it to itself

func (*Fq) Equal

func (a *Fq) Equal(b *Fq) bool

Equal returns true, if a ==b

func (*Fq) Inverse

func (a *Fq) Inverse() *Fq

Inverse inverts a field element If element is zero, it will return nil

func (*Fq) LegendreSymbolVarTime

func (f *Fq) LegendreSymbolVarTime() *Fq

func (*Fq) Mul

func (lhs *Fq) Mul(rhs *Fq) *Fq

func (*Fq) Neg

func (a *Fq) Neg() *Fq

Neg negates a Fq

func (*Fq) PowVarTime

func (f *Fq) PowVarTime(b [4]uint64) *Fq

func (*Fq) SetBytes

func (f *Fq) SetBytes(b *[32]byte) *Fq

func (*Fq) Sqrt

func (f *Fq) Sqrt() *Fq

func (*Fq) SqrtVarTime

func (f *Fq) SqrtVarTime() *Fq

func (*Fq) Square

func (a *Fq) Square() *Fq

func (*Fq) String

func (f *Fq) String() string

func (*Fq) Sub

func (a *Fq) Sub(b *Fq) *Fq

Sub Subtracts one field from another

Jump to

Keyboard shortcuts

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