BW6G1Affine
State Variables
G1_ADD
BW6_G1_ADD precompile address.
uint256 private constant G1_ADD = 0x080a;
G1_MUL
BW6_G1_MUL precompile address.
uint256 private constant G1_MUL = 0x080b;
G1_MULTIEXP
BW6_G1_MULTIEXP precompile address.
uint256 private constant G1_MULTIEXP = 0x080c;
INFINITY_FLAG
INFINITY_FLAG
bytes1 private constant INFINITY_FLAG = bytes1(0x40);
Y_IS_NEGATIVE
Y_IS_NEGATIVE
bytes1 private constant Y_IS_NEGATIVE = bytes1(0x80);
Functions
zero
Returns the additive identity element of Bw6G1.
function zero() internal pure returns (Bw6G1 memory);
Returns
Name | Type | Description |
---|---|---|
<none> | Bw6G1 | Bw6G1(BW6FP.zero(), BW6FP.zero()) |
is_zero
Returns true
if self
is equal to the additive identity.
function is_zero(Bw6G1 memory self) internal pure returns (bool);
Parameters
Name | Type | Description |
---|---|---|
self | Bw6G1 | Bw6G1. |
Returns
Name | Type | Description |
---|---|---|
<none> | bool | Result of zero check. |
is_infinity
Returns true
if self
is infinity point.
function is_infinity(Bw6G1 memory self) internal pure returns (bool);
Parameters
Name | Type | Description |
---|---|---|
self | Bw6G1 | Bw6G1. |
Returns
Name | Type | Description |
---|---|---|
<none> | bool | Result of infinity check. |
eq
Returns true
if a
is equal to a
.
function eq(Bw6G1 memory a, Bw6G1 memory b) internal pure returns (bool);
Parameters
Name | Type | Description |
---|---|---|
a | Bw6G1 | Bw6G1. |
b | Bw6G1 | Bw6G1. |
Returns
Name | Type | Description |
---|---|---|
<none> | bool | Result of equal check. |
neg
If self.is_zero()
, returns self
(== Self::zero()
).
Else, returns (x, -y)
, where self = (x, y)
.
function neg(Bw6G1 memory self) internal pure;
Parameters
Name | Type | Description |
---|---|---|
self | Bw6G1 | Bw6Fr. |
add
Returns the result of p + q
.
function add(Bw6G1 memory p, Bw6G1 memory q) internal view returns (Bw6G1 memory);
Parameters
Name | Type | Description |
---|---|---|
p | Bw6G1 | Bw6G1. |
q | Bw6G1 | Bw6G1. |
sub
Returns the result of p - q
.
function sub(Bw6G1 memory p, Bw6G1 memory q) internal view returns (Bw6G1 memory z);
Parameters
Name | Type | Description |
---|---|---|
p | Bw6G1 | Bw6G1. |
q | Bw6G1 | Bw6G1. |
Returns
Name | Type | Description |
---|---|---|
z | Bw6G1 | p - q . |
mul
Returns the result of p * scalar
.
function mul(Bw6G1 memory p, Bw6Fr memory scalar) internal view returns (Bw6G1 memory);
Parameters
Name | Type | Description |
---|---|---|
p | Bw6G1 | Bw6G1. |
scalar | Bw6Fr | Bw6Fr. |
Returns
Name | Type | Description |
---|---|---|
<none> | Bw6G1 | z p * scalar . |
msm
Multi-scalar multiplication
function msm(Bw6G1[] memory bases, Bw6Fr[] memory scalars) internal view returns (Bw6G1 memory);
Parameters
Name | Type | Description |
---|---|---|
bases | Bw6G1[] | Bw6G1[]. |
scalars | Bw6Fr[] | Bw6Fr[]. |
Returns
Name | Type | Description |
---|---|---|
<none> | Bw6G1 | Result of msm. |
from
Derive Bw6G1 from uint256[6].
function from(uint256[6] memory x) internal pure returns (Bw6G1 memory);
Parameters
Name | Type | Description |
---|---|---|
x | uint256[6] | uint256[6]. |
Returns
Name | Type | Description |
---|---|---|
<none> | Bw6G1 | Bw6G1. |
serialize
Serialize Bw6G1.
function serialize(Bw6G1 memory g1) internal pure returns (bytes memory r);
Parameters
Name | Type | Description |
---|---|---|
g1 | Bw6G1 | Bw6G1. |
Returns
Name | Type | Description |
---|---|---|
r | bytes | Compressed serialized bytes of Bw6G1. |
debug
Debug Bw6G1 in bytes.
function debug(Bw6G1 memory self) internal pure returns (bytes memory);
Parameters
Name | Type | Description |
---|---|---|
self | Bw6G1 | Bw6G1. |
Returns
Name | Type | Description |
---|---|---|
<none> | bytes | Uncompressed serialized bytes of Bw6G1. |