aboutsummaryrefslogtreecommitdiffstats
path: root/tests/primitives/test_hash_vectors.py
diff options
context:
space:
mode:
authorDonald Stufft <donald@stufft.io>2013-10-18 19:21:27 -0700
committerDonald Stufft <donald@stufft.io>2013-10-18 19:21:27 -0700
commita3011beae965fde326d4977d850b2aaa9c7b216e (patch)
tree59095660e7061e238847c3e076d2d115ac716b2f /tests/primitives/test_hash_vectors.py
parent90d2a77af90e9ed68125668e59b4d1f250938aec (diff)
parent3b7730cf90c6a5114391d2d5a2ccc1cdb448da9e (diff)
downloadcryptography-a3011beae965fde326d4977d850b2aaa9c7b216e.tar.gz
cryptography-a3011beae965fde326d4977d850b2aaa9c7b216e.tar.bz2
cryptography-a3011beae965fde326d4977d850b2aaa9c7b216e.zip
Merge pull request #123 from reaperhulk/hash-saga-sha1
Hash Saga Part 3 (API changes + SHA1)
Diffstat (limited to 'tests/primitives/test_hash_vectors.py')
-rw-r--r--tests/primitives/test_hash_vectors.py35
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/primitives/test_hash_vectors.py b/tests/primitives/test_hash_vectors.py
new file mode 100644
index 00000000..9a925e27
--- /dev/null
+++ b/tests/primitives/test_hash_vectors.py
@@ -0,0 +1,35 @@
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+# implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+from __future__ import absolute_import, division, print_function
+
+import os
+
+from cryptography.primitives import hashes
+
+from .utils import generate_hash_test
+from ..utils import load_hash_vectors_from_file
+
+
+class TestSHA1(object):
+ test_SHA1 = generate_hash_test(
+ load_hash_vectors_from_file,
+ os.path.join("NIST", "SHABYTE"),
+ [
+ "SHA1LongMsg.rsp",
+ "SHA1ShortMsg.rsp",
+ ],
+ hashes.SHA1,
+ only_if=lambda api: api.supports_hash(hashes.SHA1),
+ skip_message="Does not support SHA1",
+ )