Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
map bounds and ord to ZZ in discrete_log
Browse files Browse the repository at this point in the history
these parameters may be python ints for which the methods isqrt and
factor are not available.
  • Loading branch information
k3w1k0d3r committed Aug 8, 2022
1 parent 20ae1d8 commit 7f9cdb6
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/sage/groups/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -869,7 +869,7 @@ def discrete_log(a, base, ord=None, bounds=None, operation='*', identity=None, i
mult = op
power = lambda x, y: multiple(x, y, operation=operation, identity=identity, inverse=inverse, op=op)
if bounds:
lb, ub = bounds
lb, ub = map(integer_ring.ZZ, bounds)
if (op is None or identity is None or inverse is None or ord is None) and operation not in addition_names+multiplication_names:
raise ValueError("ord, op, identity, and inverse must all be specified for this operation")
if ord is None:
Expand All @@ -883,6 +883,8 @@ def discrete_log(a, base, ord=None, bounds=None, operation='*', identity=None, i
ord = base.additive_order()
except Exception:
ord = base.order()
else:
ord = integer_ring.ZZ(ord)
try:
from sage.rings.infinity import Infinity
if ord == +Infinity:
Expand Down

0 comments on commit 7f9cdb6

Please sign in to comment.