Skip to content

Commit aa1b889

Browse files
Merge bitcoin-core/secp256k1#996: Fix G.y parity in sage code
044d956 Fix G.y parity in sage code (Pieter Wuille) Pull request description: I'm not sure if `EllipticCurve.lift_x` has well-defined Y coordinate or not, but at least my current version of Sage computes the wrong G. Fix this. ACKs for top commit: real-or-random: ACK 044d956 Tree-SHA512: afb919af29027da2bb3c58628924f9740672d3c347ad39cc663c9c399b1aa8536256fd3fd4e1e54457e38344704d47f281d82488da413f4e6e67e191decc960f
2 parents 9526874 + 044d956 commit aa1b889

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

sage/secp256k1_params.sage

+3
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ C = EllipticCurve([F(0), F(7)])
99

1010
"""Base point of secp256k1"""
1111
G = C.lift_x(0x79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798)
12+
if int(G[1]) & 1:
13+
# G.y is even
14+
G = -G
1215

1316
"""Prime order of secp256k1"""
1417
N = C.order()

0 commit comments

Comments
 (0)