BLS12G2Affine

Git Source

State Variables

G2_ADD

BLS12_377_G2ADD precompile address.

uint256 private constant G2_ADD = 0x0804;

MAP_FP2_TO_G2

BLS12_377_MAP_FP2_TO_G2 precompile address.

uint256 private constant MAP_FP2_TO_G2 = 0x0809;

Functions

eq

Returns true if x is equal to y.

function eq(Bls12G2 memory a, Bls12G2 memory b) internal pure returns (bool);

Parameters

NameTypeDescription
aBls12G2Bls12G2.
bBls12G2Bls12G2.

Returns

NameTypeDescription
<none>boolResult of equal check.

hash_to_curve

Produce a hash of the message. This uses the IETF hash to curve's specification for Random oracle encoding (hash_to_curve) defined by combining these components. See https://tools.ietf.org/html/draft-irtf-cfrg-hash-to-curve-09#section-3

function hash_to_curve(bytes memory message) internal view returns (Bls12G2 memory);

Parameters

NameTypeDescription
messagebytesAn arbitrary-length byte string..

Returns

NameTypeDescription
<none>Bls12G2A point in Bls12G2.

add

Returns the result of p + q.

function add(Bls12G2 memory p, Bls12G2 memory q) internal view returns (Bls12G2 memory);

Parameters

NameTypeDescription
pBls12G2Bls12G2.
qBls12G2Bls12G2.

Returns

NameTypeDescription
<none>Bls12G2x + y.

map_to_curve

Map an arbitary field element to a corresponding curve point.

function map_to_curve(Bls12Fp2 memory fp2) internal view returns (Bls12G2 memory);

Parameters

NameTypeDescription
fp2Bls12Fp2Bls12Fp2.

Returns

NameTypeDescription
<none>Bls12G2A point in G2.

from

Derive Bls12G1 from uint256[8].

function from(uint256[8] memory x) internal pure returns (Bls12G2 memory);

Parameters

NameTypeDescription
xuint256[8]uint256[4].

Returns

NameTypeDescription
<none>Bls12G2Bls12G2.

debug

Debug Bls12G2 in bytes.

function debug(Bls12G2 memory p) internal pure returns (bytes memory);

Parameters

NameTypeDescription
pBls12G2Bls12G2.

Returns

NameTypeDescription
<none>bytesUncompressed serialized bytes of Bls12G2.