mirror of
https://github.com/python/cpython.git
synced 2025-08-31 14:07:50 +00:00
bpo-29410: Change the default hash algorithm to SipHash13. (GH-28752)
Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@innova.no> Co-authored-by: Christian Heimes <christian@python.org>
This commit is contained in:
parent
a1c3c9e824
commit
ad970e8623
11 changed files with 123 additions and 26 deletions
|
@ -508,7 +508,7 @@ class SysModuleTest(unittest.TestCase):
|
|||
self.assertIsInstance(sys.hash_info.nan, int)
|
||||
self.assertIsInstance(sys.hash_info.imag, int)
|
||||
algo = sysconfig.get_config_var("Py_HASH_ALGORITHM")
|
||||
if sys.hash_info.algorithm in {"fnv", "siphash24"}:
|
||||
if sys.hash_info.algorithm in {"fnv", "siphash13", "siphash24"}:
|
||||
self.assertIn(sys.hash_info.hash_bits, {32, 64})
|
||||
self.assertIn(sys.hash_info.seed_bits, {32, 64, 128})
|
||||
|
||||
|
@ -516,8 +516,10 @@ class SysModuleTest(unittest.TestCase):
|
|||
self.assertEqual(sys.hash_info.algorithm, "siphash24")
|
||||
elif algo == 2:
|
||||
self.assertEqual(sys.hash_info.algorithm, "fnv")
|
||||
elif algo == 3:
|
||||
self.assertEqual(sys.hash_info.algorithm, "siphash13")
|
||||
else:
|
||||
self.assertIn(sys.hash_info.algorithm, {"fnv", "siphash24"})
|
||||
self.assertIn(sys.hash_info.algorithm, {"fnv", "siphash13", "siphash24"})
|
||||
else:
|
||||
# PY_HASH_EXTERNAL
|
||||
self.assertEqual(algo, 0)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue