Skip to main content

FF

FF​

Kind: global class
this: {"{"}FF{"}"}

new FF()​

Creates an instance of FF.

fF.set(m)​

set to integer

Kind: instance method of FF
this: {"{"}FF{"}"}

ParamDescription
mInteger value to be set to

fF.copy(b)​

copy from FF b

Kind: instance method of FF
this: {"{"}FF{"}"}

ParamDescription
bFF element to copy from

fF.rcopy(b)​

copy from FF b

Kind: instance method of FF
this: {"{"}FF{"}"}

ParamDescription
bFF element to copy from

fF.dsucopy()​

x=y<<n

Kind: instance method of FF
this: {"{"}FF{"}"}

fF.dscopy()​

x=y

Kind: instance method of FF
this: {"{"}FF{"}"}

fF.sducopy()​

x=y>>n

Kind: instance method of FF
this: {"{"}FF{"}"}

fF.iszilch()​

test equals 0

Kind: instance method of FF
this: {"{"}FF{"}"}

fF.shrw()​

shift right by BIGBITS-bit words

Kind: instance method of FF
this: {"{"}FF{"}"}

fF.shlw()​

shift left by BIGBITS-bit words

Kind: instance method of FF
this: {"{"}FF{"}"}

fF.parity()​

extract last bit

Kind: instance method of FF
this: {"{"}FF{"}"}

fF.radd()​

recursive add

Kind: instance method of FF
this: {"{"}FF{"}"}

fF.rinc()​

recursive inc

Kind: instance method of FF
this: {"{"}FF{"}"}

fF.rsub()​

recursive sub

Kind: instance method of FF
this: {"{"}FF{"}"}

fF.rdec()​

recursive dec

Kind: instance method of FF
this: {"{"}FF{"}"}

fF.add()​

simple add

Kind: instance method of FF
this: {"{"}FF{"}"}

fF.sub()​

simple sub

Kind: instance method of FF
this: {"{"}FF{"}"}

fF.revsub()​

reverse sub

Kind: instance method of FF
this: {"{"}FF{"}"}

fF.inc()​

increment/decrement by a small integer

Kind: instance method of FF
this: {"{"}FF{"}"}

fF.rnorm()​

normalise - but hold any overflow in top part unless n<0

Kind: instance method of FF
this: {"{"}FF{"}"}

fF.shl()​

shift left by one bit

Kind: instance method of FF
this: {"{"}FF{"}"}

fF.shr()​

shift right by one bit

Kind: instance method of FF
this: {"{"}FF{"}"}

fF.toString()​

Convert to Hex String

Kind: instance method of FF
this: {"{"}FF{"}"}

fF.toBytes()​

Convert FFs to/from byte arrays

Kind: instance method of FF
this: {"{"}FF{"}"}

fF.karmul()​

z=x*y, t is workspace

Kind: instance method of FF
this: {"{"}FF{"}"}

fF.lmul()​

return low part of product this*y

Kind: instance method of FF
this: {"{"}FF{"}"}

fF.mod()​

Set b=b mod c

Kind: instance method of FF
this: {"{"}FF{"}"}

fF.reduce(N, ND) ⇒​

return this mod modulus

Kind: instance method of FF
Returns: this mod N
this: {"{"}FF{"}"}

ParamDescription
NMmodulus
NDMontgomery Constant

fF.dmod(b) ⇒​

Reduces a double-length FF with respect to a given modulus

Kind: instance method of FF
Returns: this mod N
this: {"{"}FF{"}"}

ParamDescription
bMmodulus

fF.invmodp()​

Set return=1/this mod p. Binary method - a<p on entry

Kind: instance method of FF
this: {"{"}FF{"}"}

fF.nres()​

nresidue mod m

Kind: instance method of FF
this: {"{"}FF{"}"}

fF.invmod2m()​

U=1/a mod 2^m - Arazi & Qi

Kind: instance method of FF
this: {"{"}FF{"}"}

fF.randomnum()​

generate random x

Kind: instance method of FF
this: {"{"}FF{"}"}

fF.modmul()​

this*=y mod p

Kind: instance method of FF
this: {"{"}FF{"}"}

fF.modsqr()​

this*=y mod p

Kind: instance method of FF
this: {"{"}FF{"}"}

fF.skpow(e, p)​

this=this^e mod p using side-channel resistant Montgomery Ladder, for large e

Kind: instance method of FF
this: {"{"}FF{"}"}

ParamDescription
eexponent
pmodulus

fF.skspow(e, p)​

this=this^e mod p using side-channel resistant Montgomery Ladder, for short e

Kind: instance method of FF
this: {"{"}FF{"}"}

ParamDescription
eexponent
pmodulus

fF.power(e, p)​

raise to an integer power - right-to-left method

Kind: instance method of FF
this: {"{"}FF{"}"}

ParamDescription
eexponent
pmodulus

fF.pow(e, p)​

this=this^e mod p, faster but not side channel resistant

Kind: instance method of FF
this: {"{"}FF{"}"}

ParamDescription
eexponent
pmodulus

fF.pow2(e, y, f, p)​

double exponentiation r=x^e.y^f mod p

Kind: instance method of FF
this: {"{"}FF{"}"}

ParamDescription
eexponent
yFF instance
fexponent
pmodulus

fF.cfactor(s) ⇒​

Test if an FF has factor in common with integer s

Kind: instance method of FF
Returns: true or false
this: {"{"}FF{"}"}

ParamDescription
sintegerexponent

FF.comp(a, b) ⇒​

compare a and b - must be normalised, and of same length

Kind: static method of FF
Returns: zero of error codetrue or false
this: {"{"}FF{"}"}

ParamDescription
aFF number
bFF number

FF.cswap()​

in-place swapping using xor - side channel resistant - lengths must be the same

Kind: static method of FF
this: {"{"}FF{"}"}

FF.mul()​

z=x*y. Assumes x and y are of same length.

Kind: static method of FF
this: {"{"}FF{"}"}

FF.sqr()​

z=x^2

Kind: static method of FF
this: {"{"}FF{"}"}

FF.prime(p, rmg)​

Miller-Rabin test for primality.

Kind: static method of FF
this: {"{"}FF{"}"}

ParamDescription
pFF instance to be tested
rmgan instance of a Cryptographically Secure Random Number Generator