> ## Documentation Index
> Fetch the complete documentation index at: https://voltaire.tevm.sh/llms.txt
> Use this file to discover all available pages before exploring further.

# Fp2

> Auto-generated API documentation

[**@tevm/voltaire**](../../../index.mdx)

***

[@tevm/voltaire](../../../index.mdx) / [crypto/Bls12381](../index.mdx) / Fp2

# Fp2

## Functions

### add()

> **add**(`a`, `b`): [`Bls12381Fp2Type`](../../../index/index.mdx#bls12381fp2type)

Defined in: [src/crypto/Bls12381/Fp2/add.js:11](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/crypto/Bls12381/Fp2/add.js#L11)

Add two Fp2 elements
(a0 + a1*i) + (b0 + b1*i) = (a0+b0) + (a1+b1)\*i

#### Parameters

##### a

[`Bls12381Fp2Type`](../../../index/index.mdx#bls12381fp2type)

First operand

##### b

[`Bls12381Fp2Type`](../../../index/index.mdx#bls12381fp2type)

Second operand

#### Returns

[`Bls12381Fp2Type`](../../../index/index.mdx#bls12381fp2type)

***

### conjugate()

> **conjugate**(`a`): [`Bls12381Fp2Type`](../../../index/index.mdx#bls12381fp2type)

Defined in: [src/crypto/Bls12381/Fp2/conjugate.js:10](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/crypto/Bls12381/Fp2/conjugate.js#L10)

Compute conjugate of Fp2 element
conj(a0 + a1*i) = a0 - a1*i

#### Parameters

##### a

[`Bls12381Fp2Type`](../../../index/index.mdx#bls12381fp2type)

Value to conjugate

#### Returns

[`Bls12381Fp2Type`](../../../index/index.mdx#bls12381fp2type)

***

### create()

> **create**(`c0`, `c1`): [`Bls12381Fp2Type`](../../../index/index.mdx#bls12381fp2type)

Defined in: [src/crypto/Bls12381/Fp2/create.js:10](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/crypto/Bls12381/Fp2/create.js#L10)

Create an Fp2 element from two Fp elements

#### Parameters

##### c0

`bigint`

Real component

##### c1

`bigint`

Imaginary component

#### Returns

[`Bls12381Fp2Type`](../../../index/index.mdx#bls12381fp2type)

***

### equal()

> **equal**(`a`, `b`): `boolean`

Defined in: [src/crypto/Bls12381/Fp2/equal.js:8](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/crypto/Bls12381/Fp2/equal.js#L8)

Check if two Fp2 elements are equal

#### Parameters

##### a

[`Bls12381Fp2Type`](../../../index/index.mdx#bls12381fp2type)

First operand

##### b

[`Bls12381Fp2Type`](../../../index/index.mdx#bls12381fp2type)

Second operand

#### Returns

`boolean`

***

### inv()

> **inv**(`a`): [`Bls12381Fp2Type`](../../../index/index.mdx#bls12381fp2type)

Defined in: [src/crypto/Bls12381/Fp2/inv.js:11](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/crypto/Bls12381/Fp2/inv.js#L11)

Invert an Fp2 element
1/(a0 + a1*i) = (a0 - a1*i) / (a0^2 + a1^2)
The denominator is in Fp since (a0 + a1*i)(a0 - a1*i) = a0^2 + a1^2

#### Parameters

##### a

[`Bls12381Fp2Type`](../../../index/index.mdx#bls12381fp2type)

Value to invert

#### Returns

[`Bls12381Fp2Type`](../../../index/index.mdx#bls12381fp2type)

***

### isZero()

> **isZero**(`a`): `boolean`

Defined in: [src/crypto/Bls12381/Fp2/isZero.js:7](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/crypto/Bls12381/Fp2/isZero.js#L7)

Check if an Fp2 element is zero

#### Parameters

##### a

[`Bls12381Fp2Type`](../../../index/index.mdx#bls12381fp2type)

Value to check

#### Returns

`boolean`

***

### mul()

> **mul**(`a`, `b`): [`Bls12381Fp2Type`](../../../index/index.mdx#bls12381fp2type)

Defined in: [src/crypto/Bls12381/Fp2/mul.js:12](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/crypto/Bls12381/Fp2/mul.js#L12)

Multiply two Fp2 elements
(a0 + a1*i) \* (b0 + b1*i) = (a0*b0 - a1*b1) + (a0*b1 + a1*b0)\*i
Using Karatsuba: 3 multiplications instead of 4

#### Parameters

##### a

[`Bls12381Fp2Type`](../../../index/index.mdx#bls12381fp2type)

First operand

##### b

[`Bls12381Fp2Type`](../../../index/index.mdx#bls12381fp2type)

Second operand

#### Returns

[`Bls12381Fp2Type`](../../../index/index.mdx#bls12381fp2type)

***

### mulScalar()

> **mulScalar**(`a`, `scalar`): [`Bls12381Fp2Type`](../../../index/index.mdx#bls12381fp2type)

Defined in: [src/crypto/Bls12381/Fp2/mulScalar.js:10](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/crypto/Bls12381/Fp2/mulScalar.js#L10)

Multiply Fp2 element by Fp scalar

#### Parameters

##### a

[`Bls12381Fp2Type`](../../../index/index.mdx#bls12381fp2type)

Fp2 element

##### scalar

`bigint`

Fp scalar

#### Returns

[`Bls12381Fp2Type`](../../../index/index.mdx#bls12381fp2type)

***

### neg()

> **neg**(`a`): [`Bls12381Fp2Type`](../../../index/index.mdx#bls12381fp2type)

Defined in: [src/crypto/Bls12381/Fp2/neg.js:10](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/crypto/Bls12381/Fp2/neg.js#L10)

Negate an Fp2 element
-(a0 + a1\*i) = -a0 + (-a1)\*i

#### Parameters

##### a

[`Bls12381Fp2Type`](../../../index/index.mdx#bls12381fp2type)

Value to negate

#### Returns

[`Bls12381Fp2Type`](../../../index/index.mdx#bls12381fp2type)

***

### square()

> **square**(`a`): [`Bls12381Fp2Type`](../../../index/index.mdx#bls12381fp2type)

Defined in: [src/crypto/Bls12381/Fp2/square.js:11](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/crypto/Bls12381/Fp2/square.js#L11)

Square an Fp2 element
(a0 + a1*i)^2 = (a0^2 - a1^2) + 2*a0*a1*i
Optimized: uses 2 muls instead of 3

#### Parameters

##### a

[`Bls12381Fp2Type`](../../../index/index.mdx#bls12381fp2type)

Value to square

#### Returns

[`Bls12381Fp2Type`](../../../index/index.mdx#bls12381fp2type)

***

### sub()

> **sub**(`a`, `b`): [`Bls12381Fp2Type`](../../../index/index.mdx#bls12381fp2type)

Defined in: [src/crypto/Bls12381/Fp2/sub.js:11](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/crypto/Bls12381/Fp2/sub.js#L11)

Subtract two Fp2 elements
(a0 + a1*i) - (b0 + b1*i) = (a0-b0) + (a1-b1)\*i

#### Parameters

##### a

[`Bls12381Fp2Type`](../../../index/index.mdx#bls12381fp2type)

First operand

##### b

[`Bls12381Fp2Type`](../../../index/index.mdx#bls12381fp2type)

Second operand

#### Returns

[`Bls12381Fp2Type`](../../../index/index.mdx#bls12381fp2type)
