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

Function _compute_digest_fallback

Lib/hmac.py:269–283  ·  view source on GitHub ↗
(key, msg, digest)

Source from the content-addressed store, hash-verified

267
268
269def _compute_digest_fallback(key, msg, digest):
270 digest_cons = _get_digest_constructor(digest)
271 if _is_shake_constructor(digest_cons):
272 raise ValueError(f"unsupported hash algorithm {digest}")
273 inner = digest_cons()
274 outer = digest_cons()
275 blocksize = getattr(inner, 'block_size', 64)
276 if len(key) > blocksize:
277 key = digest_cons(key).digest()
278 key = key.ljust(blocksize, b'\0')
279 inner.update(key.translate(trans_36))
280 outer.update(key.translate(trans_5C))
281 inner.update(msg)
282 outer.update(inner.digest())
283 return outer.digest()

Callers 1

digestFunction · 0.85

Calls 6

_get_digest_constructorFunction · 0.85
_is_shake_constructorFunction · 0.85
digestMethod · 0.45
ljustMethod · 0.45
updateMethod · 0.45
translateMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…