@@ -46,7 +46,7 @@ library BN254 {
4646 uint256 [2 ] Y;
4747 }
4848
49- function generatorG1 () external pure returns (G1Point memory ) {
49+ function generatorG1 () internal pure returns (G1Point memory ) {
5050 return G1Point (1 , 2 );
5151 }
5252
@@ -62,7 +62,7 @@ library BN254 {
6262 /// this is because of the (unknown to us) convention used in the bn254 pairing precompile contract
6363 /// "Elements a * i + b of F_p^2 are encoded as two elements of F_p, (a, b)."
6464 /// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-197.md#encoding
65- function generatorG2 () external pure returns (G2Point memory ) {
65+ function generatorG2 () internal pure returns (G2Point memory ) {
6666 return G2Point ([G2x1, G2x0], [G2y1, G2y0]);
6767 }
6868
@@ -73,7 +73,7 @@ library BN254 {
7373 uint256 internal constant nG2y1 = 17805874995975841540914202342111839520379459829704422454583296818431106115052 ;
7474 uint256 internal constant nG2y0 = 13392588948715843804641432497768002650278120570034223513918757245338268106653 ;
7575
76- function negGeneratorG2 () external pure returns (G2Point memory ) {
76+ function negGeneratorG2 () internal pure returns (G2Point memory ) {
7777 return G2Point ([nG2x1, nG2x0], [nG2y1, nG2y0]);
7878 }
7979
@@ -84,7 +84,7 @@ library BN254 {
8484 * @param p Some point in G1.
8585 * @return The negation of `p`, i.e. p.plus(p.negate()) should be zero.
8686 */
87- function negate (G1Point memory p ) external pure returns (G1Point memory ) {
87+ function negate (G1Point memory p ) internal pure returns (G1Point memory ) {
8888 // The prime q in the base field F_q for G1
8989 if (p.X == 0 && p.Y == 0 ) {
9090 return G1Point (0 , 0 );
@@ -122,7 +122,7 @@ library BN254 {
122122 * @param p the point to multiply
123123 * @param s the scalar to multiply by
124124 * @dev this function is only safe to use if the scalar is 9 bits or less
125- */
125+ */
126126 function scalar_mul_tiny (BN254.G1Point memory p , uint16 s ) internal view returns (BN254.G1Point memory ) {
127127 require (s < 2 ** 9 , "scalar-too-large " );
128128
@@ -155,7 +155,7 @@ library BN254 {
155155 ++ i;
156156 }
157157 }
158-
158+
159159 // return the accumulated product
160160 return acc;
161161 }
@@ -194,7 +194,7 @@ library BN254 {
194194 G2Point memory a2 ,
195195 G1Point memory b1 ,
196196 G2Point memory b2
197- ) external view returns (bool ) {
197+ ) internal view returns (bool ) {
198198 G1Point[2 ] memory p1 = [a1, b1];
199199 G2Point[2 ] memory p2 = [a2, b2];
200200
@@ -238,7 +238,7 @@ library BN254 {
238238 G1Point memory b1 ,
239239 G2Point memory b2 ,
240240 uint256 pairingGas
241- ) external view returns (bool , bool ) {
241+ ) internal view returns (bool , bool ) {
242242 G1Point[2 ] memory p1 = [a1, b1];
243243 G2Point[2 ] memory p2 = [a2, b2];
244244
@@ -270,7 +270,7 @@ library BN254 {
270270
271271 /// @return hashedG1 the keccak256 hash of the G1 Point
272272 /// @dev used for BLS signatures
273- function hashG1Point (BN254.G1Point memory pk ) external pure returns (bytes32 hashedG1 ) {
273+ function hashG1Point (BN254.G1Point memory pk ) internal pure returns (bytes32 hashedG1 ) {
274274 assembly {
275275 mstore (0 , mload (pk))
276276 mstore (0x20 , mload (add (0x20 , pk)))
@@ -282,14 +282,14 @@ library BN254 {
282282 /// @dev used for BLS signatures
283283 function hashG2Point (
284284 BN254.G2Point memory pk
285- ) external pure returns (bytes32 ) {
285+ ) internal pure returns (bytes32 ) {
286286 return keccak256 (abi.encodePacked (pk.X[0 ], pk.X[1 ], pk.Y[0 ], pk.Y[1 ]));
287287 }
288288
289289 /**
290290 * @notice adapted from https://github.com/HarryR/solcrypto/blob/master/contracts/altbn128.sol
291291 */
292- function hashToG1 (bytes32 _x ) external view returns (G1Point memory ) {
292+ function hashToG1 (bytes32 _x ) internal view returns (G1Point memory ) {
293293 uint256 beta = 0 ;
294294 uint256 y = 0 ;
295295
0 commit comments