(self)
| 365 | self.assertEqual(hexstr(h.digest()), h.hexdigest()) |
| 366 | |
| 367 | def test_digest_length_overflow(self): |
| 368 | # See issue #34922 |
| 369 | large_sizes = (2**29, 2**32-10, 2**32+10, 2**61, 2**64-10, 2**64+10) |
| 370 | for cons in self.hash_constructors: |
| 371 | h = cons(usedforsecurity=False) |
| 372 | if h.name not in self.shakes: |
| 373 | continue |
| 374 | if HASH is not None and isinstance(h, HASH): |
| 375 | # _hashopenssl's take a size_t |
| 376 | continue |
| 377 | for digest in h.digest, h.hexdigest: |
| 378 | self.assertRaises(ValueError, digest, -10) |
| 379 | for length in large_sizes: |
| 380 | with self.assertRaises((ValueError, OverflowError)): |
| 381 | digest(length) |
| 382 | |
| 383 | def test_name_attribute(self): |
| 384 | for cons in self.hash_constructors: |
nothing calls this directly
no test coverage detected