Skip to content

Commit

Permalink
Merge bitcoin-core/secp256k1#996: Fix G.y parity in sage code
Browse files Browse the repository at this point in the history
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
  • Loading branch information
real-or-random committed Oct 20, 2021
2 parents 9526874 + 044d956 commit aa1b889
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions sage/secp256k1_params.sage
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit aa1b889

Please sign in to comment.