(self)
| 411 | self.assertEqual(h.hexdigest(0), '') |
| 412 | |
| 413 | def test_shakes_invalid_digest_length(self): |
| 414 | # See https://github.com/python/cpython/issues/79103. |
| 415 | for constructor in self.shake_constructors: |
| 416 | with self.subTest(constructor=constructor): |
| 417 | h = constructor(usedforsecurity=False) |
| 418 | # Note: digest() and hexdigest() take a signed input and |
| 419 | # raise if it is negative; the rationale is that we use |
| 420 | # internally PyBytes_FromStringAndSize() and _Py_strhex() |
| 421 | # which both take a Py_ssize_t. |
| 422 | for negative_size in (-1, -10, -(1 << 31), -sys.maxsize): |
| 423 | self.assertRaises(ValueError, h.digest, negative_size) |
| 424 | self.assertRaises(ValueError, h.hexdigest, negative_size) |
| 425 | |
| 426 | def test_shakes_overflow_digest_length(self): |
| 427 | # See https://github.com/python/cpython/issues/135759. |
nothing calls this directly
no test coverage detected