-
Notifications
You must be signed in to change notification settings - Fork 1
/
Hindawi_Extract.m
119 lines (105 loc) · 3.09 KB
/
Hindawi_Extract.m
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
I=imread('stego_image.png');
var123=[];
final_msg=[];
i1=1;
checker='000000000000000000000000000000';
msg='';
while(i1<=510)
for j1=1:3:510
pixel_count=0;
for i=i1:i1+2
for j=j1:j1+2
pixel_count=pixel_count+1;
if(pixel_count==5)
A1=i;
A2=j;
m1=de2bi(I(i,j),8);
for loop=3:-1:1
msg=strcat(msg,num2str(m1(loop)));
var123=strfind(msg,checker);
if(length(var123)>=1)
break
end
end
if(length(var123)>=1)
break
end
end
end
if(length(var123)>=1)
break
end
end
inner_loop=0;
for x1=i1:i1+2
for x2=j1:j1+2
inner_loop=inner_loop+1;
if(inner_loop~=5)
if(I(x1,x2)>I(A1,A2))
di=I(x1,x2)-I(A1,A2);
elseif(I(x1,x2)==I(A1,A2))
di=0;
else
di=I(A1,A2)-I(x1,x2);
end
if(di<8)
L=0;
ti=3;
elseif(di>7 && di<16)
L=8;
ti=3;
elseif(di>15 && di<32)
L=16;
ti=3;
elseif(di>31 && di<64)
L=32;
ti=3;
elseif(di>63 && di<128)
L=64;
ti=4;
else
L=128;
ti=4;
end
S=di-L;
binary_form=fliplr(de2bi(S,ti));
for k=1:ti
msg=strcat(msg,num2str(binary_form(k)));
var123=strfind(msg,checker);
if(length(var123)>=1)
break
end
end
if(length(var123)>=1)
break
end
end
end
if(length(var123)>=1)
break
end
end
if(length(var123)>=1)
break
end
end
if(length(var123)>=1)
break
end
i1=i1+3;
end
lkj=var123(1);
lkj=lkj+6;
msg
msg=msg(1:lkj);
msg
final_msg=[];
ccc=0;
len_msg=floor(length(msg)/8);
for outer_loop=1:len_msg
ccc=ccc+1;
final_msg(outer_loop)=bin2dec(fliplr(msg(ccc:ccc+7)));
ccc=ccc+7;
end
final_msg
char(final_msg)