From 7554be4e0ae9b2f8ae0bc74e8692f79df1bf269c Mon Sep 17 00:00:00 2001 From: Gameel Ali Date: Tue, 1 Jul 2025 00:48:26 +0300 Subject: [PATCH] Create single_camper_hash.py --- algorithms/single_camper_hash.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 algorithms/single_camper_hash.py diff --git a/algorithms/single_camper_hash.py b/algorithms/single_camper_hash.py new file mode 100644 index 0000000..2bf2b97 --- /dev/null +++ b/algorithms/single_camper_hash.py @@ -0,0 +1,21 @@ +#!/usr/bin/env python + +DESCRIPTION = "Custom API hash using ROR32, constant multiplier 0xBF2E2729, and seed 0xAE54C677" +TYPE = 'unsigned_int' +TEST_1 = 0x79547269 + + +def ror(val, bits): + return ((val >> bits) | (val << (32 - bits))) & 0xFFFFFFFF + +def hash(data): + h = 0xAE54C677 + result = 0 + for c in data: + temp = ((c + h) * 0xBF2E2729) & 0xFFFFFFFF + temp = (ror(temp, 17) + 0xBF2E2729 + h) & 0xFFFFFFFF + h = (ror(temp, 15) * c) & 0xFFFFFFFF + doubled = (2 * h) & 0xFFFFFFFF + result = ror(doubled, 16) + h = ror(doubled, 14) + return result