mirror of
https://github.com/mochabyte0x/CTFPacker
synced 2026-06-06 16:14:33 +00:00
12 lines
382 B
Python
12 lines
382 B
Python
|
|
class Hasher:
|
|
|
|
def Hasher(input_string: str, INITIAL_SEED: int, INITIAL_HASH: int) -> int:
|
|
|
|
hash_value = INITIAL_HASH & 0xFFFFFFFF
|
|
|
|
for c in input_string.encode('ascii'):
|
|
hash_value = ((hash_value << INITIAL_SEED) & 0xFFFFFFFF) + hash_value
|
|
hash_value = (hash_value + c) & 0xFFFFFFFF
|
|
|
|
return f"0x{hash_value:08X}" |