Skip to content

Commit d66ae38

Browse files
authored
Merge pull request #83 from 0xx0d4y/main
Add ScoringMathTea API Hashing Algorithm
2 parents a69ca5a + 19d4457 commit d66ae38

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

algorithms/smt_api_hashing.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/usr/bin/env python
2+
import ctypes
3+
4+
DESCRIPTION = """
5+
6+
Author = 0x0d4y
7+
8+
Description = This is the API Hashing algorithm, of ScoringMathTea RAT used by Lazarus.
9+
10+
Sample_I MD5: cc9cf047aec871cefb1c7d4b8d5d3432
11+
12+
"""
13+
TYPE = 'unsigned_int'
14+
TEST_1 = 797271551
15+
16+
def hash(data):
17+
h = 0x2DBB955 # Seed value
18+
for char_byte in data:
19+
if char_byte >= 128:
20+
signed_char_val = char_byte - 256
21+
else:
22+
signed_char_val = char_byte
23+
24+
signed_h = ctypes.c_int32(h).value
25+
26+
s = signed_h >> 2
27+
m = signed_h * 32
28+
right_side = (signed_char_val + s + m)
29+
30+
h = (h ^ right_side) & 0xFFFFFFFF
31+
32+
return h

0 commit comments

Comments
 (0)