Created
January 24, 2020 23:13
-
-
Save GitMirar/4326fecc037e9c1e378ceefca6a7d7f1 to your computer and use it in GitHub Desktop.
hashing function used in https://github.com/stephenfewer/ReflectiveDLLInjection/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def _rotr(num, bits): | |
num &= (2**bits-1) | |
bit = num & 1 | |
num >>= 1 | |
if(bit): | |
num |= (1 << (bits-1)) | |
return num | |
def rotr(num): | |
key = 13 | |
for i in range(key): | |
num = _rotr(num, 32) | |
return num | |
def hash(s): | |
h = 0 | |
i = 0 | |
for c in s: | |
h = rotr(h) | |
h += ord(c) | |
i = i + 1 | |
return h |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment