aboutsummaryrefslogtreecommitdiffstats
path: root/cryptography/hazmat/primitives/hashes.py
diff options
context:
space:
mode:
Diffstat (limited to 'cryptography/hazmat/primitives/hashes.py')
-rw-r--r--cryptography/hazmat/primitives/hashes.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/cryptography/hazmat/primitives/hashes.py b/cryptography/hazmat/primitives/hashes.py
index 409f564e..35b677b0 100644
--- a/cryptography/hazmat/primitives/hashes.py
+++ b/cryptography/hazmat/primitives/hashes.py
@@ -16,7 +16,9 @@ from __future__ import absolute_import, division, print_function
import six
from cryptography import utils
-from cryptography.exceptions import AlreadyFinalized, UnsupportedInterface
+from cryptography.exceptions import (
+ AlreadyFinalized, UnsupportedAlgorithm, _Reasons
+)
from cryptography.hazmat.backends.interfaces import HashBackend
from cryptography.hazmat.primitives import interfaces
@@ -25,8 +27,10 @@ from cryptography.hazmat.primitives import interfaces
class Hash(object):
def __init__(self, algorithm, backend, ctx=None):
if not isinstance(backend, HashBackend):
- raise UnsupportedInterface(
- "Backend object does not implement HashBackend")
+ raise UnsupportedAlgorithm(
+ "Backend object does not implement HashBackend",
+ _Reasons.BACKEND_MISSING_INTERFACE
+ )
if not isinstance(algorithm, interfaces.HashAlgorithm):
raise TypeError("Expected instance of interfaces.HashAlgorithm.")