id: fp2 title: FP2 sidebar_label: FP2

FP2

Kind: global class
this: {“{”}FP2{"}"}

new FP2()

Creates an instance of FP2.

fP2.reduce()

Reduces all components of possibly unreduced FP2 mod Modulus

Kind: instance method of FP2
this: {“{”}FP2{"}"}

fP2.norm()

Normalises the components of an FP2

Kind: instance method of FP2
this: {“{”}FP2{"}"}

fP2.iszilch()

Tests for FP2 equal to zero

Kind: instance method of FP2
this: {“{”}FP2{"}"}

fP2.isunity()

Tests for FP2 equal to unity

Kind: instance method of FP2
this: {“{”}FP2{"}"}

fP2.cmove(g, d)

Conditional copy of FP2 number

Kind: instance method of FP2
this: {“{”}FP2{"}"}

ParamDescription
gFP2 instance
dcopy depends on this value

fP2.equals(x)

Tests for equality of two FP2 instances

Kind: instance method of FP2
this: {“{”}FP2{"}"}

ParamDescription
xFP2 instance to compare

fP2.getA()

extract a from this

Kind: instance method of FP2
this: {“{”}FP2{"}"}

fP2.getB()

extract b from this

Kind: instance method of FP2
this: {“{”}FP2{"}"}

fP2.set(c, d)

Set FP2 from two FP values

Kind: instance method of FP2
this: {“{”}FP2{"}"}

ParamDescription
cFP instance
dFP instance

fP2.seta(c)

Set FP2 from one FP value

Kind: instance method of FP2
this: {“{”}FP2{"}"}

ParamDescription
cFP instance

fP2.bset(c, d)

Set FP2 from two BIG values

Kind: instance method of FP2
this: {“{”}FP2{"}"}

ParamDescription
cBIG instance
dBIG instance

fP2.bseta(c)

Set FP2 from one BIG value

Kind: instance method of FP2
this: {“{”}FP2{"}"}

ParamDescription
cBIG instance

fP2.copy(x)

Copy FP2 to another FP2

Kind: instance method of FP2
this: {“{”}FP2{"}"}

ParamDescription
xFP2 instance to be copied

fP2.zero()

Set FP2 to zero

Kind: instance method of FP2
this: {“{”}FP2{"}"}

fP2.one(x)

Set FP2 to unity

Kind: instance method of FP2
this: {“{”}FP2{"}"}

ParamDescription
xFP2 instance to be set to one

fP2.neg(x)

negate this

Kind: instance method of FP2
this: {“{”}FP2{"}"}

ParamDescription
xFP2 instance to be set to one

fP2.conj()

Conjugation of FP2

Kind: instance method of FP2
this: {“{”}FP2{"}"}

fP2.add(x)

addition of two FP2s

Kind: instance method of FP2
this: {“{”}FP2{"}"}

ParamDescription
xFP2 instance

fP2.sub(x)

subtraction of two FP2s

Kind: instance method of FP2
this: {“{”}FP2{"}"}

ParamDescription
xFP2 instance

fP2.pmul(s)

Multiplication of an FP2 by an FP8

Kind: instance method of FP2
this: {“{”}FP2{"}"}

ParamDescription
sFP8 instance

fP2.imul(s)

Multiplication of an FP2 by a small integer

Kind: instance method of FP2
this: {“{”}FP2{"}"}

ParamDescription
sinteger

fP2.sqr()

Fast Squaring of an FP2

Kind: instance method of FP2
this: {“{”}FP2{"}"}

fP2.mul(y)

Full unconditional Multiplication of two FP2s

Kind: instance method of FP2
this: {“{”}FP2{"}"}

ParamDescription
yFP2 instance, the multiplier

fP2.sqrt() ⇒

sqrt(a+ib) = sqrt(a+sqrt(a_a-n_b_b)/2)+ib/(2_sqrt(a+sqrt(a_a-n_b*b)/2))

Kind: instance method of FP2
Returns: true if this is QR
this: {“{”}FP2{"}"}

fP2.toString()

convert this to hex string

Kind: instance method of FP2
this: {“{”}FP2{"}"}

fP2.inverse()

Inverting an FP2

Kind: instance method of FP2
this: {“{”}FP2{"}"}

fP2.div2()

Divide an FP2 by 2

Kind: instance method of FP2
this: {“{”}FP2{"}"}

fP2.times_i()

Multiply an FP2 by sqrt(-1)

Kind: instance method of FP2
this: {“{”}FP2{"}"}

fP2.mul_ip()

Multiply an FP2 by (1+sqrt(-1))

Kind: instance method of FP2
this: {“{”}FP2{"}"}

fP2.div_ip2()

Divide an FP2 by (1+sqrt(-1))/2

Kind: instance method of FP2
this: {“{”}FP2{"}"}

fP2.div_ip()

Divide an FP2 by (1+sqrt(-1))

Kind: instance method of FP2
this: {“{”}FP2{"}"}

fP2.pow(e)

Raises an FP2 to the power of a BIG

Kind: instance method of FP2
this: {“{”}FP2{"}"}

ParamDescription
eBIG instance exponent