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

Method get_cnonce

Lib/urllib/request.py:1107–1116  ·  view source on GitHub ↗
(self, nonce)

Source from the content-addressed store, hash-verified

1105 return resp
1106
1107 def get_cnonce(self, nonce):
1108 # The cnonce-value is an opaque
1109 # quoted string value provided by the client and used by both client
1110 # and server to avoid chosen plaintext attacks, to provide mutual
1111 # authentication, and to provide some message integrity protection.
1112 # This isn't a fabulous effort, but it's probably Good Enough.
1113 s = "%s:%s:%s:" % (self.nonce_count, nonce, time.ctime())
1114 b = s.encode("ascii") + _randombytes(8)
1115 dig = hashlib.sha1(b).hexdigest()
1116 return dig[:16]
1117
1118 def get_authorization(self, req, chal):
1119 try:

Callers 1

get_authorizationMethod · 0.95

Calls 3

hexdigestMethod · 0.80
ctimeMethod · 0.45
encodeMethod · 0.45

Tested by

no test coverage detected