#include #include #include #include #define CORRUPT_CHANCE 1 int main(int argc, char *argv[]) { char buf[4096]; int res, x; srandom(time(NULL) + getpid()); for (;;) { if ((res = read(0, buf, sizeof(buf))) <= 0) return 0; for (x = 0; x < res; x++) { if (random() % 10000 < CORRUPT_CHANCE) buf[x] ^= (1 << random() % 8); } write(1, buf, res); } return 0; }