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

Method check_hmac_hexdigest

Lib/test/test_hmac.py:349–364  ·  view source on GitHub ↗

Check and return a HMAC digest computed by hmac_digest_func(). This HMAC digest is computed by: hmac_digest_func(key, msg, **hmac_digest_kwds) This is typically useful for checking one-shot HMAC functions.

(
        self, key, msg, hexdigest, digest_size,
        hmac_digest_func, hmac_digest_kwds=frozendict(),
    )

Source from the content-addressed store, hash-verified

347 )
348
349 def check_hmac_hexdigest(
350 self, key, msg, hexdigest, digest_size,
351 hmac_digest_func, hmac_digest_kwds=frozendict(),
352 ):
353 """Check and return a HMAC digest computed by hmac_digest_func().
354
355 This HMAC digest is computed by:
356
357 hmac_digest_func(key, msg, **hmac_digest_kwds)
358
359 This is typically useful for checking one-shot HMAC functions.
360 """
361 d = hmac_digest_func(key, msg, **hmac_digest_kwds)
362 self.assertEqual(len(d), digest_size)
363 self.assertEqual(d, binascii.unhexlify(hexdigest))
364 return d
365
366 def assert_hmac_common_cases(
367 self, key, msg, hexdigest, digestmod, hashname, digest_size, block_size

Callers 3

assert_hmac_hexdigestMethod · 0.95

Calls 2

frozendictClass · 0.85
assertEqualMethod · 0.45

Tested by

no test coverage detected