BLS12G2Affine
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
Name | Type | Description |
---|---|---|
a | Bls12G2 | Bls12G2. |
b | Bls12G2 | Bls12G2. |
Returns
Name | Type | Description |
---|---|---|
<none> | bool | Result 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
Name | Type | Description |
---|---|---|
message | bytes | An arbitrary-length byte string.. |
Returns
Name | Type | Description |
---|---|---|
<none> | Bls12G2 | A point in Bls12G2. |
add
Returns the result of p + q
.
function add(Bls12G2 memory p, Bls12G2 memory q) internal view returns (Bls12G2 memory);
Parameters
Name | Type | Description |
---|---|---|
p | Bls12G2 | Bls12G2. |
q | Bls12G2 | Bls12G2. |
Returns
Name | Type | Description |
---|---|---|
<none> | Bls12G2 | x + 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
Name | Type | Description |
---|---|---|
fp2 | Bls12Fp2 | Bls12Fp2. |
Returns
Name | Type | Description |
---|---|---|
<none> | Bls12G2 | A point in G2. |
from
Derive Bls12G1 from uint256[8].
function from(uint256[8] memory x) internal pure returns (Bls12G2 memory);
Parameters
Name | Type | Description |
---|---|---|
x | uint256[8] | uint256[4]. |
Returns
Name | Type | Description |
---|---|---|
<none> | Bls12G2 | Bls12G2. |
debug
Debug Bls12G2 in bytes.
function debug(Bls12G2 memory p) internal pure returns (bytes memory);
Parameters
Name | Type | Description |
---|---|---|
p | Bls12G2 | Bls12G2. |
Returns
Name | Type | Description |
---|---|---|
<none> | bytes | Uncompressed serialized bytes of Bls12G2. |