@tevm/voltaire / crypto/Bls12381 / Fp2
Fp2
Functions
add()
add(Defined in: src/crypto/Bls12381/Fp2/add.js:11 Add two Fp2 elements (a0 + a1i) + (b0 + b1i) = (a0+b0) + (a1+b1)*ia,b):Bls12381Fp2Type
Parameters
a
Bls12381Fp2Type
First operand
b
Bls12381Fp2Type
Second operand
Returns
Bls12381Fp2Type
conjugate()
conjugate(Defined in: src/crypto/Bls12381/Fp2/conjugate.js:10 Compute conjugate of Fp2 element conj(a0 + a1i) = a0 - a1ia):Bls12381Fp2Type
Parameters
a
Bls12381Fp2Type
Value to conjugate
Returns
Bls12381Fp2Type
create()
create(Defined in: src/crypto/Bls12381/Fp2/create.js:10 Create an Fp2 element from two Fp elementsc0,c1):Bls12381Fp2Type
Parameters
c0
bigint
Real component
c1
bigint
Imaginary component
Returns
Bls12381Fp2Type
equal()
equal(Defined in: src/crypto/Bls12381/Fp2/equal.js:8 Check if two Fp2 elements are equala,b):boolean
Parameters
a
Bls12381Fp2Type
First operand
b
Bls12381Fp2Type
Second operand
Returns
boolean
inv()
inv(Defined in: src/crypto/Bls12381/Fp2/inv.js:11 Invert an Fp2 element 1/(a0 + a1i) = (a0 - a1i) / (a0^2 + a1^2) The denominator is in Fp since (a0 + a1i)(a0 - a1i) = a0^2 + a1^2a):Bls12381Fp2Type
Parameters
a
Bls12381Fp2Type
Value to invert
Returns
Bls12381Fp2Type
isZero()
isZero(Defined in: src/crypto/Bls12381/Fp2/isZero.js:7 Check if an Fp2 element is zeroa):boolean
Parameters
a
Bls12381Fp2Type
Value to check
Returns
boolean
mul()
mul(Defined in: src/crypto/Bls12381/Fp2/mul.js:12 Multiply two Fp2 elements (a0 + a1i) * (b0 + b1i) = (a0b0 - a1b1) + (a0b1 + a1b0)*i Using Karatsuba: 3 multiplications instead of 4a,b):Bls12381Fp2Type
Parameters
a
Bls12381Fp2Type
First operand
b
Bls12381Fp2Type
Second operand
Returns
Bls12381Fp2Type
mulScalar()
mulScalar(Defined in: src/crypto/Bls12381/Fp2/mulScalar.js:10 Multiply Fp2 element by Fp scalara,scalar):Bls12381Fp2Type
Parameters
a
Bls12381Fp2Type
Fp2 element
scalar
bigint
Fp scalar
Returns
Bls12381Fp2Type
neg()
neg(Defined in: src/crypto/Bls12381/Fp2/neg.js:10 Negate an Fp2 element -(a0 + a1*i) = -a0 + (-a1)*ia):Bls12381Fp2Type
Parameters
a
Bls12381Fp2Type
Value to negate
Returns
Bls12381Fp2Type
square()
square(Defined in: src/crypto/Bls12381/Fp2/square.js:11 Square an Fp2 element (a0 + a1i)^2 = (a0^2 - a1^2) + 2a0a1i Optimized: uses 2 muls instead of 3a):Bls12381Fp2Type
Parameters
a
Bls12381Fp2Type
Value to square
Returns
Bls12381Fp2Type
sub()
sub(Defined in: src/crypto/Bls12381/Fp2/sub.js:11 Subtract two Fp2 elements (a0 + a1i) - (b0 + b1i) = (a0-b0) + (a1-b1)*ia,b):Bls12381Fp2Type
Parameters
a
Bls12381Fp2Type
First operand
b
Bls12381Fp2Type
Second operand
Returns
Bls12381Fp2Type
