code: def _discrete_log_shanks_steps(n, a, b, order=None):
      """
      Baby-step giant-step algorithm for computing the discrete logarithm of
      ``a`` to the base ``b`` modulo ``n``.
  
      The algorithm is a time-memory trade-off of the method of exhaustive
      search. It uses `O(sqrt(m))` memory, where `m` is the group order.
  
      Examples
      ========
  
      >>> from sympy.ntheory.residue_ntheory import _discrete_log_shanks_steps
      >>> _discrete_log_shanks_steps(41, 15, 7)
      3
  
      See Also
      ========
  
      discrete_log
  
      References
      ==========
  
      .. [1] "Handbook of applied cryptography", Menezes, A. J., Van, O. P. C., &
          Vanstone, S. A. (1997).
      """
      a %= n
      b %= n
      if order is None:
          order = n_order(b, n)
      m = sqrt(order) + 1
      T = {}
      x = 1
      for i in range(m):
          T[x] = i
          x = x * b % n
      z = pow(b, -m, n)
      x = a
      for i in range(m):
          if x in T:
              return i * m + T[x]
          x = x * z % n
      raise ValueError("Log does not exist")
  
imports: from __future__ import annotations
  from sympy.external.gmpy import gcd, lcm, invert, sqrt, legendre, jacobi, kronecker, bit_scan1, remove
  from sympy.polys import Poly
  from sympy.polys.domains import ZZ
  from sympy.polys.galoistools import gf_crt1, gf_crt2, linear_congruence, gf_csolve
  from .primetest import isprime
  from .factor_ import factorint, _perfect_power
  from .modular import crt
  from sympy.utilities.decorator import deprecated
  from sympy.utilities.memoization import recurrence_memo
  from sympy.utilities.misc import as_int
  from sympy.utilities.iterables import iproduct
  from sympy.core.random import _randint, randint
  from itertools import product
label_desc: Use image node_id 24 for calling a global function with example usage: _discrete_log_shanks_steps(n, a, b, order) and returns: unknown