diff options
author | Paul Kehrer <paul.l.kehrer@gmail.com> | 2014-01-19 13:20:42 -0600 |
---|---|---|
committer | Paul Kehrer <paul.l.kehrer@gmail.com> | 2014-01-19 13:20:42 -0600 |
commit | b545e9e56fe1d2bb2c827cf61c4beb45826709e5 (patch) | |
tree | 3b462d85f50752876861a74c79df63d004064f15 | |
parent | 33cd92ddcf10f976eda510fdad73b0c06a4bf75b (diff) | |
download | cryptography-b545e9e56fe1d2bb2c827cf61c4beb45826709e5.tar.gz cryptography-b545e9e56fe1d2bb2c827cf61c4beb45826709e5.tar.bz2 cryptography-b545e9e56fe1d2bb2c827cf61c4beb45826709e5.zip |
move HashMethods to top level
-rw-r--r-- | cryptography/hazmat/backends/commoncrypto/backend.py | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/cryptography/hazmat/backends/commoncrypto/backend.py b/cryptography/hazmat/backends/commoncrypto/backend.py index a7a81ce6..3d98bf6b 100644 --- a/cryptography/hazmat/backends/commoncrypto/backend.py +++ b/cryptography/hazmat/backends/commoncrypto/backend.py @@ -24,15 +24,17 @@ from cryptography.hazmat.bindings.commoncrypto.binding import Binding from cryptography.hazmat.primitives import interfaces +HashMethods = namedtuple( + "HashMethods", ["ctx", "hash_init", "hash_update", "hash_final"] +) + + @utils.register_interface(HashBackend) class Backend(object): """ CommonCrypto API wrapper. """ name = "commoncrypto" - HashMethods = namedtuple( - "HashMethods", ["ctx", "hash_init", "hash_update", "hash_final"] - ) def __init__(self): self._binding = Binding() @@ -40,27 +42,27 @@ class Backend(object): self._lib = self._binding.lib self._hash_mapping = { - "md5": self.HashMethods( + "md5": HashMethods( "CC_MD5_CTX *", self._lib.CC_MD5_Init, self._lib.CC_MD5_Update, self._lib.CC_MD5_Final ), - "sha1": self.HashMethods( + "sha1": HashMethods( "CC_SHA1_CTX *", self._lib.CC_SHA1_Init, self._lib.CC_SHA1_Update, self._lib.CC_SHA1_Final ), - "sha224": self.HashMethods( + "sha224": HashMethods( "CC_SHA256_CTX *", self._lib.CC_SHA224_Init, self._lib.CC_SHA224_Update, self._lib.CC_SHA224_Final ), - "sha256": self.HashMethods( + "sha256": HashMethods( "CC_SHA256_CTX *", self._lib.CC_SHA256_Init, self._lib.CC_SHA256_Update, self._lib.CC_SHA256_Final ), - "sha384": self.HashMethods( + "sha384": HashMethods( "CC_SHA512_CTX *", self._lib.CC_SHA384_Init, self._lib.CC_SHA384_Update, self._lib.CC_SHA384_Final ), - "sha512": self.HashMethods( + "sha512": HashMethods( "CC_SHA512_CTX *", self._lib.CC_SHA512_Init, self._lib.CC_SHA512_Update, self._lib.CC_SHA512_Final ), |