BN256G2
The IBN256G2
interface provides functionality for performing addition operations on points in the G2 subgroup of the BN256 elliptic curve. This user guide will explain how to interact with the function provided by the IBN256G2
interface.
Functions
ecTwistAdd()
This function performs the addition operation on two points in the G2 subgroup of the BN256 elliptic curve.
Parameters
pt1xx
(uint256): The xx-coordinate of the first point.pt1xy
(uint256): The xy-coordinate of the first point.pt1yx
(uint256): The yx-coordinate of the first point.pt1yy
(uint256): The yy-coordinate of the first point.pt2xx
(uint256): The xx-coordinate of the second point.pt2xy
(uint256): The xy-coordinate of the second point.pt2yx
(uint256): The yx-coordinate of the second point.pt2yy
(uint256): The yy-coordinate of the second point.
Usage
To perform the addition operation on two points in the G2 subgroup of the BN256 elliptic curve, call the ecTwistAdd()
function with the required parameters:
IBN256G2 bn256g2Instance = IBN256G2(bn256g2Address);
(uint256 pt3xx, uint256 pt3xy, uint256 pt3yx, uint256 pt3yy) = bn256g2Instance.ecTwistAdd(
pt1xx, pt1xy, pt1yx, pt1yy,
pt2xx, pt2xy, pt2yx, pt2yy
);
Replace bn256g2Address
with the address of an existing IBN256G2
implementation. Replace pt1xx
, pt1xy
, pt1yx
, pt1yy
, pt2xx
, pt2xy
, pt2yx
, and pt2yy
with the coordinates of the points you want to add. The resulting point, pt3
, will have the coordinates (pt3xx
, pt3xy
, pt3yx
, pt3yy
).
The ecTwistAdd()
function allows you to perform elliptic curve operations on the BN256 curve in the G2 subgroup, which can be useful for cryptographic applications such as zero-knowledge proofs, signature schemes, and more.