Skip to content

Commit

Permalink
Modify tests in ell_point.py to be more generic
Browse files Browse the repository at this point in the history
Make the tests of `.weil_pairing` and `.tate_pairing` independent of the implementation of `GF(65537^2)`, in view of Conway database update
  • Loading branch information
S17A05 committed May 8, 2024
1 parent 744939e commit 6f0fca4
Showing 1 changed file with 9 additions and 16 deletions.
25 changes: 9 additions & 16 deletions src/sage/schemes/elliptic_curves/ell_point.py
Original file line number Diff line number Diff line change
Expand Up @@ -1833,16 +1833,20 @@ def weil_pairing(self, Q, n, algorithm=None):
TESTS:
Check that the original Sage implementation still works::
Check that the original Sage implementation still works and
that the result coincides with the PARI implementation::
sage: # needs sage.rings.finite_rings
sage: GF(65537^2).inject_variables()
Defining z2
sage: E = EllipticCurve(GF(65537^2), [0,1])
sage: P = E(22, 28891)
sage: Q = E(-93, 40438*z2 + 31573)
sage: P.weil_pairing(Q, 7282, algorithm='sage')
19937*z2 + 65384
sage: R, S = E.torsion_basis(7282)
sage: a, b = ZZ.random_element(), ZZ.random_element()
sage: P = a*R + b*S
sage: c, d = ZZ.random_element(), ZZ.random_element()
sage: Q = c*R + d*S
sage: P.weil_pairing(Q, 7282, algorithm='sage') == P.weil_pairing(Q, 7282, algorithm='pari')
True
Passing an unknown ``algorithm=`` argument should fail::
Expand Down Expand Up @@ -2049,17 +2053,6 @@ def tate_pairing(self, Q, n, k, q=None):
TESTS:
Check that the PARI output matches the original Sage implementation::
sage: # needs sage.rings.finite_rings
sage: GF(65537^2).inject_variables()
Defining z2
sage: E = EllipticCurve(GF(65537^2), [0,1])
sage: P = E(22, 28891)
sage: Q = E(-93, 40438*z2 + 31573)
sage: P.tate_pairing(Q, 7282, 2)
34585*z2 + 4063
The point ``P (self)`` must have ``n`` torsion::
sage: P.tate_pairing(Q, 163, 2)
Expand Down

0 comments on commit 6f0fca4

Please sign in to comment.