Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions algorithms/DJB2_Upper_3698.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
DESCRIPTION = "Custom hash algorithm using initial value 3698 with multiplier 33"
TYPE = 'unsigned_int'
# Hash of 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'
TEST_1 = 3023272509

def hash(data):
hash_value = 3698
for byte in data:
upper_char = byte if byte < 97 or byte > 122 else byte - 32
hash_value = (hash_value * 33 + upper_char) & 0xFFFFFFFF
return hash_value