MCPcopy Index your code
hub / github.com/python/cpython / answer_challenge

Function answer_challenge

Lib/multiprocessing/connection.py:987–1002  ·  view source on GitHub ↗
(connection, authkey: bytes)

Source from the content-addressed store, hash-verified

985
986
987def answer_challenge(connection, authkey: bytes):
988 if not isinstance(authkey, bytes):
989 raise ValueError(
990 "Authkey must be bytes, not {0!s}".format(type(authkey)))
991 message = connection.recv_bytes(256) # reject large message
992 if not message.startswith(_CHALLENGE):
993 raise AuthenticationError(
994 f'Protocol error, expected challenge: {message=}')
995 message = message[len(_CHALLENGE):]
996 if len(message) < _MD5ONLY_MESSAGE_LENGTH:
997 raise AuthenticationError(f'challenge too short: {len(message)} bytes')
998 digest = _create_response(authkey, message)
999 connection.send_bytes(digest)
1000 response = connection.recv_bytes(256) # reject large message
1001 if response != _WELCOME:
1002 raise AuthenticationError('digest sent was rejected')
1003
1004#
1005# Support for using xmlrpclib for serialization

Callers 2

acceptMethod · 0.85
ClientFunction · 0.85

Calls 6

AuthenticationErrorClass · 0.85
_create_responseFunction · 0.85
formatMethod · 0.45
recv_bytesMethod · 0.45
startswithMethod · 0.45
send_bytesMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…