Hey guys,
Just needing your help on this code.
#include <stdio.h>
int main() {
FILE *fin,*fout;
char c;
fin=fopen("input.img","rb");
fout=fopen("output.img","wb");
while ((c=fgetc(fin))!= EOF) {
fputc(c, fout);
}
return 0;
fclose(fin);
fclose(fout);
}
I'm trying to unscramble a scrambled image and this just outputs nothing. Would you guys be able to help me? Thanks.
Here's part of what I need to do. I don't know how to reverse exclusive OR :
The next random number in the sequence is found from the current number using the following linear congruential generator
n=(n*106+1283)%6075;
where n is the current number. The first number in the sequence is 1 and so the sequence starts:
1,1389,2717,3760,4968,5441,904.....
The image is stored in a file called mystery.img which is exactly 40000 bytes long. Each byte gives the brightness of a point in the image. You can view the file using the program display.exe on the H: drive.
Each byte in the image file has been EXCLUSIVE ORed with the bottom 8 bits of the corresponding number in the sequence so that the image is lost in the randomness. This operation is reversible.