diff options
author | Bénédikt Tran <10796600+picnixz@users.noreply.github.com> | 2025-03-17 10:10:03 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-03-17 10:10:03 (GMT) |
commit | de8890f5ab1c1e767029d46c20f513beefc47b18 (patch) | |
tree | e1e33cc3247e57c099a2c61f463e7e65efb9ec1e /Lib/hmac.py | |
parent | 85c04f80fd3a3098674f60038f248c076a476acf (diff) | |
download | cpython-de8890f5ab1c1e767029d46c20f513beefc47b18.zip cpython-de8890f5ab1c1e767029d46c20f513beefc47b18.tar.gz cpython-de8890f5ab1c1e767029d46c20f513beefc47b18.tar.bz2 |
gh-130149: cleanup refactorization of `test_hmac.py` (#131318)
New features:
* refactor `hashlib_helper.requires_hashdigest` in prevision of a future
`hashlib_helper.requires_builtin_hashdigest` for built-in hashes only
* add `hashlib_helper.requires_openssl_hashdigest` to request OpenSSL
hashes, assuming that `_hashlib` exists.
Refactoring:
* split hmac.copy() test by implementation
* update how algorithms are discovered for RFC test cases
* simplify how OpenSSL hash digests are requested
* refactor hexdigest tests for RFC test vectors
* typo fix: `assert_hmac_hexdigest_by_new` -> `assert_hmac_hexdigest_by_name`
Improvements:
* strengthen contract on `hmac_new_by_name` and `hmac_digest_by_name`
* rename mixin classes to better match their responsibility
Diffstat (limited to 'Lib/hmac.py')
-rw-r--r-- | Lib/hmac.py | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/Lib/hmac.py b/Lib/hmac.py index 8b4eb2f..30b6b47 100644 --- a/Lib/hmac.py +++ b/Lib/hmac.py @@ -65,6 +65,7 @@ class HMAC: def _init_hmac(self, key, msg, digestmod): self._hmac = _hashopenssl.hmac_new(key, msg, digestmod=digestmod) + self._inner = self._outer = None # because the slots are defined self.digest_size = self._hmac.digest_size self.block_size = self._hmac.block_size |