Skip to content

Commit

Permalink
add fnv1a 32 bit hash test
Browse files Browse the repository at this point in the history
  • Loading branch information
barrust committed Jan 1, 2024
1 parent a72a8a8 commit 8da2b3a
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tests/hashes_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
default_fnv_1a,
default_md5,
default_sha256,
fnv_1a_32,
hash_with_depth_bytes,
hash_with_depth_int,
)
Expand Down Expand Up @@ -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 = [
Expand Down

0 comments on commit 8da2b3a

Please sign in to comment.