We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2d539d1 commit 15d67b7Copy full SHA for 15d67b7
src/Secp256Lib.sol
@@ -2,6 +2,8 @@
2
pragma solidity ^0.8.13;
3
4
library Secp256k1 {
5
+ error Secp256k1__InvalidPoint(uint256 x, uint256 y);
6
+
7
// Curve parameters for secp256k1
8
uint256 constant a = 0;
9
uint256 constant b = 7;
@@ -22,8 +24,13 @@ library Secp256k1 {
22
24
return leftHandSide == rightHandSide;
23
25
}
26
27
+ function negatePoint(uint256 x, uint256 y) internal pure returns (uint256, uint256) {
28
+ if (!isOnCurve(x, y)) revert Secp256k1__InvalidPoint(x, y);
29
+ if (isInfinity(x, y)) return (x, y);
30
+ return (x, p - y);
31
+ }
32
33
function addPoint() internal {}
- function negatePoint() internal {}
34
function orderOfPoint() internal {}
35
function scalarMultiply() internal {}
36
0 commit comments