aboutsummaryrefslogtreecommitdiffstats
path: root/cryptography
diff options
context:
space:
mode:
authorDavid Reid <dreid@dreid.org>2013-10-31 15:22:49 -0700
committerDavid Reid <dreid@dreid.org>2013-10-31 15:22:49 -0700
commitbb0d3f0f2d064f4674793f2e0d8e9a3f04ad3ef1 (patch)
treecc2bc8af3fee57794440b7a933a74b51fe3f3999 /cryptography
parentc3d029f2de71f74efe8ab6caf6ea9604a83a0531 (diff)
downloadcryptography-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.py2
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: