diff options
author | David Reid <dreid@dreid.org> | 2013-10-31 15:22:49 -0700 |
---|---|---|
committer | David Reid <dreid@dreid.org> | 2013-10-31 15:22:49 -0700 |
commit | bb0d3f0f2d064f4674793f2e0d8e9a3f04ad3ef1 (patch) | |
tree | cc2bc8af3fee57794440b7a933a74b51fe3f3999 /cryptography | |
parent | c3d029f2de71f74efe8ab6caf6ea9604a83a0531 (diff) | |
download | cryptography-bb0d3f0f2d064f4674793f2e0d8e9a3f04ad3ef1.tar.gz cryptography-bb0d3f0f2d064f4674793f2e0d8e9a3f04ad3ef1.tar.bz2 cryptography-bb0d3f0f2d064f4674793f2e0d8e9a3f04ad3ef1.zip |
Enforce that Hash takes a HashAlgorithm instance.
Diffstat (limited to 'cryptography')
-rw-r--r-- | cryptography/hazmat/primitives/hashes.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/cryptography/hazmat/primitives/hashes.py b/cryptography/hazmat/primitives/hashes.py index 97e9bf4a..a50017bc 100644 --- a/cryptography/hazmat/primitives/hashes.py +++ b/cryptography/hazmat/primitives/hashes.py @@ -21,6 +21,8 @@ from cryptography.hazmat.primitives import interfaces @interfaces.register(interfaces.HashContext) class Hash(object): def __init__(self, algorithm, backend=None, ctx=None): + if not isinstance(algorithm, interfaces.HashAlgorithm): + raise TypeError("Expected instance of interfaces.HashAlgorithm.") self.algorithm = algorithm if backend is None: |