MCPcopy Index your code
hub / github.com/RustPython/RustPython / deliver_challenge

Function deliver_challenge

Lib/multiprocessing/connection.py:928–946  ·  view source on GitHub ↗
(connection, authkey: bytes, digest_name='sha256')

Source from the content-addressed store, hash-verified

926
927
928def deliver_challenge(connection, authkey: bytes, digest_name='sha256'):
929 if not isinstance(authkey, bytes):
930 raise ValueError(
931 "Authkey must be bytes, not {0!s}".format(type(authkey)))
932 assert MESSAGE_LENGTH > _MD5ONLY_MESSAGE_LENGTH, "protocol constraint"
933 message = os.urandom(MESSAGE_LENGTH)
934 message = b'{%s}%s' % (digest_name.encode('ascii'), message)
935 # Even when sending a challenge to a legacy client that does not support
936 # digest prefixes, they'll take the entire thing as a challenge and
937 # respond to it with a raw HMAC-MD5.
938 connection.send_bytes(_CHALLENGE + message)
939 response = connection.recv_bytes(256) # reject large message
940 try:
941 _verify_challenge(authkey, message, response)
942 except AuthenticationError:
943 connection.send_bytes(_FAILURE)
944 raise
945 else:
946 connection.send_bytes(_WELCOME)
947
948
949def answer_challenge(connection, authkey: bytes):

Callers 2

acceptMethod · 0.85
ClientFunction · 0.85

Calls 6

isinstanceFunction · 0.85
_verify_challengeFunction · 0.85
formatMethod · 0.45
encodeMethod · 0.45
send_bytesMethod · 0.45
recv_bytesMethod · 0.45

Tested by

no test coverage detected