-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathself_md5.c
34 lines (31 loc) · 957 Bytes
/
self_md5.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include <stdio.h>
#include <string.h>
#define P "1111111111111111"
#define Q "2222222222222222"
#define PP P P P P P P P P
#define QQ Q Q Q Q Q Q Q Q
#define BIT PP QQ
#define DIGIT BIT BIT BIT BIT
#define DIGIT_4 DIGIT DIGIT DIGIT DIGIT
#define DIGIT_16 DIGIT_4 DIGIT_4 DIGIT_4 DIGIT_4
#define PLACEHOLDER DIGIT_16 DIGIT_16
char* padding = "PADDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDING";
char* data = PLACEHOLDER;
char* table = "0123456789ABCDEF";
int main() {
printf("The md5sum of this program is: ");
for (int i = 0; i < 32; i++) {
int n = 0;
if (memcmp(data, data + 128, 128) == 0) n += 1;
data += 256;
if (memcmp(data, data + 128, 128) == 0) n += 2;
data += 256;
if (memcmp(data, data + 128, 128) == 0) n += 4;
data += 256;
if (memcmp(data, data + 128, 128) == 0) n += 8;
data += 256;
printf("%c", table[n]);
}
printf("\n");
return 0;
}