ECDSA
Library for handling Elliptic Curve Digital Signature Algorithm (ECDSA) operations on a compatible curve
Functions
zz2Aff
Convert from XYZZ coordinates to affine coordinates Learn more about the XYZZ representation here: https://hyperelliptic.org/EFD/g1p/auto-shortw-xyzz-3.html#addition-add-2008-s*
function zz2Aff(uint256 x, uint256 y, uint256 zz, uint256 zzz) internal returns (uint256 x1, uint256 y1);
Parameters
Name | Type | Description |
---|---|---|
x | uint256 | The X-coordinate of the point in XYZZ representation |
y | uint256 | The Y-coordinate of the point in XYZZ representation |
zz | uint256 | The ZZ value of the point in XYZZ representation |
zzz | uint256 | The ZZZ value of the point in XYZZ representation |
Returns
Name | Type | Description |
---|---|---|
x1 | uint256 | The X-coordinate of the point in affine representation |
y1 | uint256 | The Y-coordinate of the point in affine representation |
zzAddN
Adds a point in XYZZ coordinates to a point in affine coordinates
function zzAddN(
uint256 x1,
uint256 y1,
uint256 zz1,
uint256 zzz1,
uint256 x2,
uint256 y2
)
internal
pure
returns (uint256 P0, uint256 P1, uint256 P2, uint256 P3);
Parameters
Name | Type | Description |
---|---|---|
x1 | uint256 | The X-coordinate of the first point |
y1 | uint256 | The Y-coordinate of the first point |
zz1 | uint256 | The ZZ value of the first point |
zzz1 | uint256 | The ZZZ value of the first point |
x2 | uint256 | The X-coordinate of the second point |
y2 | uint256 | The Y-coordinate of the second point |
Returns
Name | Type | Description |
---|---|---|
P0 | uint256 | The X-coordinate of the resulting point |
P1 | uint256 | The Y-coordinate of the resulting point |
P2 | uint256 | The ZZ value of the resulting point |
P3 | uint256 | The ZZZ value of the resulting point |
zzDouble
Performs point doubling operation in XYZZ coordinates on an elliptic curve
This implements the "dbl-2008-s-1" doubling formulas from Sutherland's 2008 paper
function zzDouble(
uint256 x,
uint256 y,
uint256 zz,
uint256 zzz
)
internal
pure
returns (uint256 P0, uint256 P1, uint256 P2, uint256 P3);
Parameters
Name | Type | Description |
---|---|---|
x | uint256 | The X-coordinate of the point |
y | uint256 | The Y-coordinate of the point |
zz | uint256 | The ZZ value of the point |
zzz | uint256 | The ZZZ value of the point |
Returns
Name | Type | Description |
---|---|---|
P0 | uint256 | The X-coordinate of the resulting point after doubling |
P1 | uint256 | The Y-coordinate of the resulting point after doubling |
P2 | uint256 | The ZZ value of the resulting point after doubling |
P3 | uint256 | The ZZZ value of the resulting point after doubling |
affIsOnCurve
Check if a point in affine coordinates is on the curve
function affIsOnCurve(uint256 x, uint256 y) internal pure returns (bool);
Parameters
Name | Type | Description |
---|---|---|
x | uint256 | The X-coordinate of the point |
y | uint256 | The Y-coordinate of the point |
Returns
Name | Type | Description |
---|---|---|
<none> | bool | bool True if the point is on the curve, false otherwise |
affAdd
Add two points on the elliptic curve in affine coordinates
function affAdd(uint256 x0, uint256 y0, uint256 x1, uint256 y1) internal returns (uint256 x2, uint256 y2);
Parameters
Name | Type | Description |
---|---|---|
x0 | uint256 | The X-coordinate of the first point |
y0 | uint256 | The Y-coordinate of the first point |
x1 | uint256 | The X-coordinate of the second point |
y1 | uint256 | The Y-coordinate of the second point |
Returns
Name | Type | Description |
---|---|---|
x2 | uint256 | The X-coordinate of the resulting point |
y2 | uint256 | The Y-coordinate of the resulting point |