#include #define KEY_LENGTH 5 // Can be anything from 1 to 15 main(){ unsigned int ch; FILE *fpIn; int i; unsigned char key[KEY_LENGTH] = {0x00, 0x00, 0x00, 0x00, 0x00}; /* of course, the all-0 key was probably not the one actually used... */ fpIn = fopen("ctext.txt", "r"); i=0; while (fscanf(fpIn, "%2x", &ch) != EOF) { printf("%c", ch ^ key[i % KEY_LENGTH]); i++; } fclose(fpIn); return; }