Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
gh-38341: Implement EllipticCurve_with_prime_order() constructor
<!-- ^ Please provide a concise and informative title. --> <!-- ^ Don't put issue numbers in the title, do this in the PR description below. --> <!-- ^ For example, instead of "Fixes #12345" use "Introduce new method to calculate 1 + 2". --> <!-- v Describe your changes below in detail. --> <!-- v Why is this change required? What problem does it solve? --> <!-- v If this PR resolves an open issue, please link to it here. For example, "Fixes #12345". --> Me and @grhkm21 suggest this diff against develop that implements the `EllipticCurve_with_prime_order(N)` constructor. Using the prime order `N` in input, this method finds another prime `p` and constructs an elliptic curve `E/Fp` with `#E(Fp) = N`. It follows Algorithm 2.2 of the paper [Constructing Elliptic Curves of prime order](https://arxiv.org/abs/0712.2022) by Bröker and Stevenhagen. The running time is quite random depending on the input parameter but can turn out to be fast for some larger values (≃ 256 bits primes). It's also worth noticing that some values will make this function run for a **very** long time. There had been a [PR](#37119) by @grhkm21 and @GiacomoPope that implements the `EllipticCurve_with_order()` method. This PR would intuitively fit nice into their work but I felt uncomfortable with it returning an iterator. I felt like returning a single curve was more handy so I implemented this method in a separate function that does so but I'm open to suggestions if this is of any interest to the community. Fixes #38342 ### 📝 Checklist - [x] The title is concise and informative. - [x] The description explains in detail what this PR is about. - [x] I have linked a relevant issue or discussion. - [x] I have created tests covering the changes. - [x] I have updated the documentation and checked the documentation preview. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on. For example, --> <!-- - #12345: short description why this is a dependency --> <!-- - #34567: ... --> URL: #38341 Reported by: grnx Reviewer(s): grhkm21, grnx, Vincent Macri
- Loading branch information