code: def challenge_auth(username, password, challenge, lower, digest='sha256'):
      
      def hdig(x):
          return fdigest(x).hexdigest()
  
      fdigest = get_digest(digest)
      luser = lower(username)
      tpass = password[:10].encode("ascii")
      hvalue = hdig("{0}:{1}".format(luser, hdig(tpass)).encode("ascii"))
      bhvalue = hvalue.encode("ascii")
      bchallenge = challenge.encode("ascii")
      return hmac.HMAC(bhvalue, bchallenge, digestmod=fdigest).hexdigest()
docs: Calculates quakenet's challenge auth hash
  
      .. code-block:: python
  
          >>> challenge_auth("mooking", "0000000000",
          ...     "12345678901234567890123456789012", str.lower, "md5")
          '2ed1a1f1d2cd5487d2e18f27213286b9'