MCPcopy Create free account
hub / github.com/python/cpython / hmac_digest_by_name

Method hmac_digest_by_name

Lib/test/test_hmac.py:224–232  ·  view source on GitHub ↗

Alternative implementation of hmac_digest(). Unlike hmac_digest(), this method may assert the type of 'hashname' as it should only be used in tests that are expected to compute a HMAC digest.

(self, key, msg=None, *, hashname)

Source from the content-addressed store, hash-verified

222 return self.hmac_new(key, msg, digestmod=hashname)
223
224 def hmac_digest_by_name(self, key, msg=None, *, hashname):
225 """Alternative implementation of hmac_digest().
226
227 Unlike hmac_digest(), this method may assert the type of 'hashname'
228 as it should only be used in tests that are expected to compute a
229 HMAC digest.
230 """
231 self.assertIsInstance(hashname, str)
232 return self.hmac_digest(key, msg, digestmod=hashname)
233
234 def assert_hmac(
235 self, key, msg, hexdigest, hashfunc, hashname, digest_size, block_size

Callers

nothing calls this directly

Calls 2

assertIsInstanceMethod · 0.80
hmac_digestMethod · 0.45

Tested by

no test coverage detected