From 9bae6c8894e87d012a4237466cc75c4833b69fa2 Mon Sep 17 00:00:00 2001 From: Gameel Ali Date: Sat, 20 Sep 2025 12:04:55 +0300 Subject: [PATCH] Create djb2_seed5385_upper.py --- algorithms/djb2_seed5385_upper.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 algorithms/djb2_seed5385_upper.py diff --git a/algorithms/djb2_seed5385_upper.py b/algorithms/djb2_seed5385_upper.py new file mode 100644 index 0000000..5fbc181 --- /dev/null +++ b/algorithms/djb2_seed5385_upper.py @@ -0,0 +1,20 @@ +#!/usr/bin/env python +DESCRIPTION = "DJB2 variant with seed 5385 and uppercase normalization" +TYPE = 'unsigned_int' +TEST_1 = 2671650580 + + +def hash(data): + """Compute the API hash from byte input. + Returns a 32-bit unsigned int. + """ + if isinstance(data, str): + data = data.encode('utf-8') + + h = 5385 + for b in data: + c = b + if c > 96: # lowercase -> uppercase for ASCII + c -= 32 + h = (h * 33 + c) & 0xFFFFFFFF + return h