Skip to content

Python 3 compatibility - FractionField OverflowError #12

@vladpetcu

Description

@vladpetcu

Hi there,

Trying to get a random point on the elliptic curve raises an OverflowError in fields/FractionField for a 1536 bit p.
At lines 17-18 division must be done with // resulting in an int, that fixes the problem in my case.
I am using python 3.8 and reading your comment here #11 (comment) I guess ecpy was designed for python 2 at start but should work with python 3 too.

p = int(1641994227143377578153959399792871920054683918885673627721570851196750119415869674552942116832787561034894051277808905393148828520318225610178038512107187213731502506665338175685440485362224276062335386653431331251385091624504002080671595682282775620734083404790580129809073016308980466457936622480862655461693371423143228641053476783371900991044809670840439812478238543038118782100267663731306103046856471371034228707099062234903458075497898386216130191035140731)

F = FiniteField(p)
E = EllipticCurve(F, 0, 1)
P_pr = E.random_point()

Hope it helps.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions