Merge bitcoin-core/secp256k1#996: Fix G.y parity in sage code

044d956305 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 044d956305

Tree-SHA512: afb919af29027da2bb3c58628924f9740672d3c347ad39cc663c9c399b1aa8536256fd3fd4e1e54457e38344704d47f281d82488da413f4e6e67e191decc960f
This commit is contained in:
Tim Ruffing 2021-10-20 16:28:06 +02:00
commit aa1b889b61
No known key found for this signature in database
GPG Key ID: 8C461CCD293F6011
1 changed files with 3 additions and 0 deletions

View File

@ -9,6 +9,9 @@ C = EllipticCurve([F(0), F(7)])
"""Base point of secp256k1"""
G = C.lift_x(0x79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798)
if int(G[1]) & 1:
# G.y is even
G = -G
"""Prime order of secp256k1"""
N = C.order()