-
-
Save anonymous/eab53c545c143ec65a4b to your computer and use it in GitHub Desktop.
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 <inttypes.h> | |
// only works on little-endian machines, i suppose | |
int main(int argc, char *argv[]) { | |
FILE *fp = fopen(argv[1], "rb"); | |
fseek(fp, 0L, SEEK_END); | |
int s = ftell(fp); | |
fseek(fp, 0L, SEEK_SET); | |
uint32_t p1, p2, p3, p4; | |
p1 = p2 = p3 = p4 = 0x11111111; | |
uint32_t a1, a2, a3, a4; | |
s -= 16; | |
while (s > 0) { | |
fread(&a1, 4, 1, fp); | |
fread(&a2, 4, 1, fp); | |
fread(&a3, 4, 1, fp); | |
fread(&a4, 4, 1, fp); | |
p1 += a1; | |
p2 += (p1 < a1) + a2; | |
p3 += a3; | |
p4 += (p3 < a3) + a4; | |
s -= 16; | |
} | |
fclose(fp); | |
printf("%x %x %x %x\n", p1, p2, p3, p4); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment