7 #define BLOBSIZE (1<<(BLOBBITS-1))
9 #define WINDOWSIZE (1<<(WINDOWBITS-1))
12 static uint32_t rol(uint32_t v, unsigned bits)
15 return (v << bits) | (v >> (32-bits));
19 static uint32_t stupidsum_add(uint32_t old, uint8_t drop, uint8_t add)
21 return ((old<<1) | (old>>31)) ^ drop ^ add;
27 printf("hello world\n");
28 assert(rol(1,0) == 1);
29 assert(rol(1,1) == 2);
30 assert(rol(1,32) == 1);
31 assert(rol(1,33) == 2);
32 assert(rol(0x12345678, 16) == 0x56781234);
33 assert(rol(0x12345678, 34) == 0x48d159e0);
34 assert(rol(0x92345678, 34) == 0x48d159e2);
35 assert(WINDOWSIZE >= 32);
36 assert(BLOBSIZE >= 32);
38 uint8_t buf[WINDOWSIZE];
40 int i = 0, count = 0, c;
42 memset(buf, 0, sizeof(buf));
44 while ((c = fgetc(stdin)) != EOF)
46 sum = stupidsum_add(sum, buf[i], c);
49 int cprint = (c >= 32 && c <= 126) ? c : '.';
50 printf("[%05X] %02X '%c' %08X\n", i, c, cprint, sum);
52 i = (i + 1) % WINDOWSIZE;
55 if ((sum & (BLOBSIZE-1)) == 0)
57 printf("\nSPLIT @ %d (%d)\n\n", count, BLOBSIZE);
59 memset(buf, 0, sizeof(buf));