-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdecryption_scramblng.m
More file actions
31 lines (31 loc) · 865 Bytes
/
decryption_scramblng.m
File metadata and controls
31 lines (31 loc) · 865 Bytes
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
P = [11 12 13 14;21 22 23 24; 31 32 33 34; 41 42 43 44];
O = [2 1 4 3; 4 2 3 1; 3 4 1 2; 1 3 2 4];
Q = [3 1 2 4; 4 2 3 1 ; 1 3 4 2; 2 4 1 3];
l = 2;
L =4;
for i = 1:L
for j = 1:L
a = O(i,j);
b = Q(a,j);
m1 = floor(((a-1)/l));
n1 = mod((a-1),l);
m2 = floor(((b-1)/l));
n2 = mod((b-1),l)+1;
x = m1*l+m2+1;
y = n1*l+n2;
T(x,y) = P(i,j);
end
end
for i = 1:L
for j = 1:L
a = O(i,j);
b = Q(a,j);
m1 = floor(((a-1)/l));
n1 = mod((a-1),l);
m2 = floor(((b-1)/l))+1;
n2 = mod((b-1),l)+1;
x = m1*l+m2;
y = n1*l+n2;
K(i,j) = T(x,y);
end
end