/checksum.cpp Secret
Last active
March 19, 2017 15:52
Star
You must be signed in to star a gist
Checksum calculator (from NeutrinoBot Loader)
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
#include <stdio.h> | |
#include <string.h> | |
#ifdef _MSC_VER | |
#include <stdint.h> | |
#else | |
#include <inttypes.h> | |
#endif | |
#ifndef DWORD | |
typedef uint32_t DWORD; | |
#endif | |
inline DWORD rotl32a(DWORD x, DWORD n) | |
{ | |
return (x<<n) | (x>>(32-n)); | |
} | |
inline char to_lower(char c) | |
{ | |
if (c >= 'A' && c <= 'Z') { | |
c = c - 'A' + 'a'; | |
} | |
return c; | |
} | |
DWORD calc_checksum(char *str, bool lowercase = true) | |
{ | |
if (str == NULL) return 0; | |
DWORD checksum = 0; | |
size_t len = strlen(str); | |
for (int i = 0; i < len; i++) { | |
checksum = rotl32a(checksum, 7); | |
char c = str[i]; | |
if (lowercase) c = to_lower(c); | |
checksum ^= c; | |
} | |
return checksum; | |
} | |
int main(int argc, char *argv[]) | |
{ | |
char test_str[] = "kernel32.dll"; | |
char *str = NULL; | |
if (argc < 2) { | |
str = test_str; | |
} else { | |
str = argv[1]; | |
} | |
printf("%s\n", str); | |
printf("%X\n", calc_checksum(str)); | |
return 0; | |
} |
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
0x642742FF ; VBoxMiniRdrDN | |
0x283CC630 ; VBoxGuest | |
0x911E353 | |
0xEDB71E9 |
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
0x1C669D6A | |
0xC2F56A18 | |
0xC106E17B | |
0x5608BCC4 | |
0x6512F9D0 | |
0xC604D52A ; snxhk.dll | |
0x4D0651A5 | |
0xAC12B9FB ; sbiedll.dll | |
0x5B747561 | |
0x53309C85 | |
0xE53ED522 |
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
0x6169078A | |
0x47000343 | |
0xC608982D | |
0x46EE4F10 | |
0xF6EC4B30 | |
0xB1CBC652 ; vboxservice.exe | |
0x6D3E6FDD ; vboxtray.exe | |
0x583EB7E8 | |
0xC03EAA65 |
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
0xFE9EA0D5 | |
0x6689BB92 | |
0x3C5FF312 ; procexpl | |
0x9B5A88D9 ; procmon_window_class | |
0x4B4576B5 | |
0xAED304FC | |
0x225FD98F | |
0x6D3FA1CA | |
0xCF388E01 | |
0xD486D951 | |
0x39177889 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment