summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_hashlib.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_hashlib.py')
-rw-r--r--Lib/test/test_hashlib.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/test/test_hashlib.py b/Lib/test/test_hashlib.py
index b7b04a3..46088e5 100644
--- a/Lib/test/test_hashlib.py
+++ b/Lib/test/test_hashlib.py
@@ -190,6 +190,15 @@ class HashLibTestCase(unittest.TestCase):
self.assertTrue(set(hashlib.algorithms_guaranteed).
issubset(hashlib.algorithms_available))
+ def test_usedforsecurity(self):
+ for cons in self.hash_constructors:
+ cons(usedforsecurity=True)
+ cons(usedforsecurity=False)
+ cons(b'', usedforsecurity=True)
+ cons(b'', usedforsecurity=False)
+ hashlib.new("sha256", usedforsecurity=True)
+ hashlib.new("sha256", usedforsecurity=False)
+
def test_unknown_hash(self):
self.assertRaises(ValueError, hashlib.new, 'spam spam spam spam spam')
self.assertRaises(TypeError, hashlib.new, 1)