From e0608db24e4744fd0aeb83a52d173e66989cd54c Mon Sep 17 00:00:00 2001 From: Paul Kehrer Date: Wed, 29 Jan 2014 17:17:44 -0600 Subject: simplify hmac supported and hash supported calls for commoncrypto --- cryptography/hazmat/backends/commoncrypto/backend.py | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/cryptography/hazmat/backends/commoncrypto/backend.py b/cryptography/hazmat/backends/commoncrypto/backend.py index 4e70cab5..b612a805 100644 --- a/cryptography/hazmat/backends/commoncrypto/backend.py +++ b/cryptography/hazmat/backends/commoncrypto/backend.py @@ -90,20 +90,10 @@ class Backend(object): } def hash_supported(self, algorithm): - try: - self._hash_mapping[algorithm.name] - except KeyError: - return False - else: - return True + return algorithm.name in self._hash_mapping def hmac_supported(self, algorithm): - try: - self._supported_hmac_algorithms[algorithm.name] - except KeyError: - return False - else: - return True + return algorithm.name in self._supported_hmac_algorithms def create_hash_ctx(self, algorithm): return _HashContext(self, algorithm) -- cgit v1.2.3