/* * This is a simple program to scramble a file to prevent casual users * from grabbing test versions */ #include /* * rcode key < infile > outfile */ int main( argc, argv ) int argc; char **argv; { unsigned char mapping[256], mask, block[4096]; char *key; int i, k, nread; /* Get the key from input */ if (argc != 2) { fprintf( stderr, "Key required\n" ); exit( 1 ); } /* Fill the mapping from the key. Note that the key only has a subrange of set bits */ key = argv[1]; for (i=0; i<256; i++) { if (!*key) key = argv[1]; mask = *key++ - ' '; if (i & mask) mask |= 0xa0; mapping[i] = mask; } /* Read stdin, xor with rotating mapping, and write to stdout */ k = 0; while ((nread = fread( block, 1, 4096, stdin )) > 0) { for (i=0; i