-
Notifications
You must be signed in to change notification settings - Fork 0
/
encry.m
101 lines (63 loc) · 1.25 KB
/
encry.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
clc
clear all
close all
objt=audiorecorder
recordblocking(objt,5)
play(objt)
aa=getaudiodata(objt);
figure,plot(aa)
blocksize=8;
inp=reshape(aa,200,200);
host=inp+0.8;
tic
x=uint8(host+128);
figure,imshow(x,[])
[a b c]=size(x);
N=a*b;
m(1)=0.8;
for i=1:N-1
m(i+1)=4*m(i)-4*m(i)^2;
end
m=mod(1000*m,200);
m=uint8(m);
n=1;
for i=1:a
for j=1:b
I1= x;
e(i,j)=bitxor(m(n),x(i,j));
n=n+1;
end
end
figure,imshow(e)
imwrite(e,'e.jpg');
bkjbjb
% clear;
% clc;
e=imread('e.jpg')
x1=uint8(e);
[a1 b1 c1]=size(x1);
N1=a1*b1;
m1(1)=0.8;
for i=1:N1-1
m1(i+1)=4*m1(i)-4*m1(i)^2;
end
m1=mod(1000*m1,256);
m1=uint8(m1);
n1=1;
for i=1:a1
for j=1:b1
e1(i,j)=bitxor(m1(n1),x1(i,j));
n1=n1+1;
end
end
figure,imshow(e1)
s ='MATLAB'
val=double(s)
nume=reshape(val, 3, 5)
m = [1 5 3; 2 11 8; 4 24 21]
nume=nume-32
ncoded=mod(m*(nume),95)+32
scoded=reshape(char(ncoded),1,15)
sdecoded = reshape(double(scoded),3,5)
ndecoded = mod (inv(m)*(sdecoded-32), 95) + 32
sdecoded = reshape (char(ndecoded), 1, 15)