From 8da2b3a9725d9122e58a215e2186801b60c57d84 Mon Sep 17 00:00:00 2001 From: barrust Date: Mon, 1 Jan 2024 16:39:33 -0500 Subject: [PATCH] add fnv1a 32 bit hash test --- tests/hashes_test.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/hashes_test.py b/tests/hashes_test.py index 0f10af9..0fa7cb7 100755 --- a/tests/hashes_test.py +++ b/tests/hashes_test.py @@ -16,6 +16,7 @@ default_fnv_1a, default_md5, default_sha256, + fnv_1a_32, hash_with_depth_bytes, hash_with_depth_int, ) @@ -54,6 +55,13 @@ def test_default_hash_colision(self): for i in range(1, 5): self.assertNotEqual(h1[i], h2[i]) + def test_fnv_1a_32(self): + """test fnv_1a 32 bit hash""" + hash = fnv_1a_32("this is a test", 0) + self.assertEqual(hash, 2139996864) + hash = fnv_1a_32("this is also a test", 0) + self.assertEqual(hash, 1462718619) + def test_default_md5(self): """test default md5 algorithm""" this_is_a_test = [