-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtestStego.c
52 lines (50 loc) · 1.37 KB
/
testStego.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#include <stdio.h>
#include <stdlib.h>
#define KGRN "\x1B[32m" //Green colour for the terminal
#define KWHT "\x1b[0m" //White colour for the terminal
int main(){
FILE *f,*pic;
int c=0,flag=0;
char oa[1000];
char ob[1000];
unsigned int bufferF,bufferP;
printf("\n Please give path of the %sfile%s: ",KGRN,KWHT);
gets(oa);
f=fopen(oa,"rb+");
if(!f){
printf("\n File not found");
return -1;
}else
printf(" %s------------------------\n %sFile successfully opened\n %s------------------------%s",KGRN,KWHT,KGRN,KWHT);
printf("\n Please give the path of the %spicture%s: ",KGRN,KWHT);
gets(ob);
pic=fopen(ob,"rb+");
if(!pic){
printf("\n File not found");
return -1;
}else
printf(" %s------------------------\n %sFile successfully opened\n %s------------------------%s",KGRN,KWHT,KGRN,KWHT);
while(!feof(f)){
fread(&bufferF,sizeof(char),1,f);
if(!feof(f)){
while(!feof(pic) && flag==0){
c++;
fread(&bufferP,sizeof(char),1,pic);
if(bufferF==bufferP){
printf("\n File hex: %02x Picture hex: %02x counter= %d counter hex: %02x",bufferF,bufferP,c,c);
flag=1;
}
}
if (flag==0){
printf("\n File hex: %02x NO MATCH FOUND",bufferF);
printf("\n\n Try a larger/more diverse file\n\n");
return -1;
}
fseek(pic, SEEK_SET, 0);
flag=0;
c=0;
}
}
printf("\n");
return(0);
}