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=types.MappingProxyType({}),
)
| 348 | ) |
| 349 | |
| 350 | def check_hmac_hexdigest( |
| 351 | self, key, msg, hexdigest, digest_size, |
| 352 | hmac_digest_func, hmac_digest_kwds=types.MappingProxyType({}), |
| 353 | ): |
| 354 | """Check and return a HMAC digest computed by hmac_digest_func(). |
| 355 | |
| 356 | This HMAC digest is computed by: |
| 357 | |
| 358 | hmac_digest_func(key, msg, **hmac_digest_kwds) |
| 359 | |
| 360 | This is typically useful for checking one-shot HMAC functions. |
| 361 | """ |
| 362 | d = hmac_digest_func(key, msg, **hmac_digest_kwds) |
| 363 | self.assertEqual(len(d), digest_size) |
| 364 | self.assertEqual(d, binascii.unhexlify(hexdigest)) |
| 365 | return d |
| 366 | |
| 367 | def assert_hmac_common_cases( |
| 368 | self, key, msg, hexdigest, digestmod, hashname, digest_size, block_size |
no test coverage detected