├── .gitattributes ├── A New Approach of Image Encryption Using 3D.pdf ├── Relevent images ├── Decrypted images │ ├── Decrypted_deblur.jpg │ ├── Decrypted_lena.jpg │ ├── Decrypted_mandrill.jpg │ └── Decrypted_peppers.jpg ├── Encrypted images │ ├── encypted_deblur.jpg │ ├── encypted_lena.jpg │ ├── encypted_mandrill.jpg │ └── encypted_peppers.jpg └── original images │ ├── deblur.jpg │ ├── lena.jpg │ ├── mandrill.jpg │ └── peppers.jpg └── matlab code ├── Correlation_column_only.m ├── Correlation_of_row_col.m ├── Correlation_row_only.m ├── Encryption_Decryption_total_process.m ├── Entrophy_analysis.m ├── Histogram_Analysis.m ├── Image_show.m ├── Key_Sensitivity_analysis.m ├── NPCR_UACI_total.m ├── NPCR_only.m ├── UACI_only.m └── logistic_map_analysis.m /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto -------------------------------------------------------------------------------- /A New Approach of Image Encryption Using 3D.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/billalkuet07/A-New-Approach-of-Image-Encryption-Using-3D/89b15df6a34c28d961339a89e5c33449820a5e56/A New Approach of Image Encryption Using 3D.pdf -------------------------------------------------------------------------------- /Relevent images/Decrypted images/Decrypted_deblur.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/billalkuet07/A-New-Approach-of-Image-Encryption-Using-3D/89b15df6a34c28d961339a89e5c33449820a5e56/Relevent images/Decrypted images/Decrypted_deblur.jpg -------------------------------------------------------------------------------- /Relevent images/Decrypted images/Decrypted_lena.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/billalkuet07/A-New-Approach-of-Image-Encryption-Using-3D/89b15df6a34c28d961339a89e5c33449820a5e56/Relevent images/Decrypted images/Decrypted_lena.jpg -------------------------------------------------------------------------------- /Relevent images/Decrypted images/Decrypted_mandrill.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/billalkuet07/A-New-Approach-of-Image-Encryption-Using-3D/89b15df6a34c28d961339a89e5c33449820a5e56/Relevent images/Decrypted images/Decrypted_mandrill.jpg -------------------------------------------------------------------------------- /Relevent images/Decrypted images/Decrypted_peppers.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/billalkuet07/A-New-Approach-of-Image-Encryption-Using-3D/89b15df6a34c28d961339a89e5c33449820a5e56/Relevent images/Decrypted images/Decrypted_peppers.jpg -------------------------------------------------------------------------------- /Relevent images/Encrypted images/encypted_deblur.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/billalkuet07/A-New-Approach-of-Image-Encryption-Using-3D/89b15df6a34c28d961339a89e5c33449820a5e56/Relevent images/Encrypted images/encypted_deblur.jpg -------------------------------------------------------------------------------- /Relevent images/Encrypted images/encypted_lena.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/billalkuet07/A-New-Approach-of-Image-Encryption-Using-3D/89b15df6a34c28d961339a89e5c33449820a5e56/Relevent images/Encrypted images/encypted_lena.jpg -------------------------------------------------------------------------------- /Relevent images/Encrypted images/encypted_mandrill.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/billalkuet07/A-New-Approach-of-Image-Encryption-Using-3D/89b15df6a34c28d961339a89e5c33449820a5e56/Relevent images/Encrypted images/encypted_mandrill.jpg -------------------------------------------------------------------------------- /Relevent images/Encrypted images/encypted_peppers.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/billalkuet07/A-New-Approach-of-Image-Encryption-Using-3D/89b15df6a34c28d961339a89e5c33449820a5e56/Relevent images/Encrypted images/encypted_peppers.jpg -------------------------------------------------------------------------------- /Relevent images/original images/deblur.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/billalkuet07/A-New-Approach-of-Image-Encryption-Using-3D/89b15df6a34c28d961339a89e5c33449820a5e56/Relevent images/original images/deblur.jpg -------------------------------------------------------------------------------- /Relevent images/original images/lena.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/billalkuet07/A-New-Approach-of-Image-Encryption-Using-3D/89b15df6a34c28d961339a89e5c33449820a5e56/Relevent images/original images/lena.jpg -------------------------------------------------------------------------------- /Relevent images/original images/mandrill.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/billalkuet07/A-New-Approach-of-Image-Encryption-Using-3D/89b15df6a34c28d961339a89e5c33449820a5e56/Relevent images/original images/mandrill.jpg -------------------------------------------------------------------------------- /Relevent images/original images/peppers.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/billalkuet07/A-New-Approach-of-Image-Encryption-Using-3D/89b15df6a34c28d961339a89e5c33449820a5e56/Relevent images/original images/peppers.jpg -------------------------------------------------------------------------------- /matlab code/Correlation_column_only.m: -------------------------------------------------------------------------------- 1 | clc; 2 | clear all; 3 | original=imread('encypted_lena.jpg'); 4 | % rgb=rgb2gray(original); 5 | rgb=original; 6 | [row,col]=size(rgb); 7 | total_length=row*col; 8 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 9 | %%%%%%%%%%%%%%%%%%%%VERTICAL CORRELATION%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 10 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 11 | 12 | %%%for ttotal image 13 | % x=zeros(1,(row*col)/2); 14 | % y=zeros(1,(row*col)/2); 15 | 16 | %%%% for 1000 pair %%% 17 | x=zeros(1,(256*40)); 18 | y=zeros(1,(256*40)); 19 | %%%%%%%%%%%%%%%%%%% 20 | k=0; 21 | l=0; 22 | % for j=1:1:col 23 | for j=1:1:80 24 | for i=1:1:row 25 | if(mod(j,2)==0) 26 | k=k+1; 27 | x(1,k)=rgb(i,j); 28 | else 29 | l=l+1; 30 | y(1,l)=rgb(i,j); 31 | end 32 | end 33 | end 34 | % figure 35 | % scatter(x,y,2) 36 | % title('Vertical corralation of peppers image'); 37 | R = corrcoef(x,y) 38 | 39 | -------------------------------------------------------------------------------- /matlab code/Correlation_of_row_col.m: -------------------------------------------------------------------------------- 1 | %%%%%%%%%%%%%%%%%%%ORIGINAL IMAGE CORRELATION%%%%%%%%%%%%%%%%%%%%%%%%% 2 | clc; 3 | clear all; 4 | original=imread('deblur.jpg'); 5 | rgb=rgb2gray(original); 6 | [row,col]=size(rgb); 7 | total_length=row*col; 8 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 9 | %%%%%%%%%%%%%%%%%%%%VERTICAL CORRELATION%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 10 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 11 | x=zeros(1,(row*col)/2); 12 | y=zeros(1,(row*col)/2); 13 | k=0; 14 | l=0; 15 | for j=1:1:col 16 | for i=1:1:row 17 | if(mod(j,2)==0) 18 | k=k+1; 19 | x(1,k)=rgb(i,j); 20 | else 21 | l=l+1; 22 | y(1,l)=rgb(i,j); 23 | end 24 | end 25 | end 26 | figure 27 | subplot(2,2,1) 28 | scatter(x,y,2) 29 | title('Vertical Correlation of original deblur Image'); 30 | xlabel('(a)') 31 | 32 | original=imread('deblur.jpg'); 33 | rgb=rgb2gray(original); 34 | [row,col]=size(rgb); 35 | total_length=row*col; 36 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 37 | %%%%%%%%%%%%%%%%%HORIZONTAL CORRELATION%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 38 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 39 | x=zeros(1,(row*col)/2); 40 | y=zeros(1,(row*col)/2); 41 | k=0; 42 | l=0; 43 | for i=1:1:row 44 | for j=1:1:col 45 | if(mod(i,2)==0) 46 | k=k+1; 47 | x(1,k)=rgb(i,j); 48 | else 49 | l=l+1; 50 | y(1,l)=rgb(i,j); 51 | end 52 | end 53 | end 54 | subplot(2,2,2) 55 | scatter(x,y,2) 56 | title('Horizontal Correlation of original deblur Image'); 57 | xlabel('(b)') 58 | 59 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%ENCRYPTED IMAGE CORRELATION%%%%%%%%%%%%%%%% 60 | 61 | original=imread('encypted_deblur.jpg'); 62 | rgb=original; 63 | [row,col]=size(rgb); 64 | total_length=row*col; 65 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 66 | %%%%%%%%%%%%%%%%%%%%VERTICAL CORRELATION%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 67 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 68 | x=zeros(1,(row*col)/2); 69 | y=zeros(1,(row*col)/2); 70 | k=0; 71 | l=0; 72 | for j=1:1:col 73 | for i=1:1:row 74 | if(mod(j,2)==0) 75 | k=k+1; 76 | x(1,k)=rgb(i,j); 77 | else 78 | l=l+1; 79 | y(1,l)=rgb(i,j); 80 | end 81 | end 82 | end 83 | subplot(2,2,3) 84 | scatter(x,y,2) 85 | title('Vertical Correlation of Encrypted deblur Image'); 86 | xlabel('(c)') 87 | 88 | original=imread('encypted_deblur.jpg'); 89 | rgb=original; 90 | [row,col]=size(rgb); 91 | total_length=row*col; 92 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 93 | %%%%%%%%%%%%%%%%%HORIZONTAL CORRELATION%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 94 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 95 | x=zeros(1,(row*col)/2); 96 | y=zeros(1,(row*col)/2); 97 | k=0; 98 | l=0; 99 | for i=1:1:row 100 | for j=1:1:col 101 | if(mod(i,2)==0) 102 | k=k+1; 103 | x(1,k)=rgb(i,j); 104 | else 105 | l=l+1; 106 | y(1,l)=rgb(i,j); 107 | end 108 | end 109 | end 110 | subplot(2,2,4) 111 | scatter(x,y,2) 112 | xlabel('(d)') 113 | title('Horizontal Correlation of Encrypted deblur Image'); 114 | 115 | 116 | -------------------------------------------------------------------------------- /matlab code/Correlation_row_only.m: -------------------------------------------------------------------------------- 1 | clc; 2 | clear all; 3 | original=imread('peppers.jpg'); 4 | rgb=rgb2gray(original); 5 | % rgb=original; 6 | [row,col]=size(rgb); 7 | total_length=row*col; 8 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 9 | %%%%%%%%%%%%%%%%%HORIZONTAL CORRELATION%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 10 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 11 | x=zeros(1,(row*col)/2); 12 | y=zeros(1,(row*col)/2); 13 | k=0; 14 | l=0; 15 | for i=1:1:row 16 | for j=1:1:col 17 | if(mod(i,2)==0) 18 | k=k+1; 19 | x(1,k)=rgb(i,j); 20 | else 21 | l=l+1; 22 | y(1,l)=rgb(i,j); 23 | end 24 | end 25 | end 26 | % figure 27 | % scatter(x,y,2) 28 | % title('Horizontal corralation of peppers image'); 29 | 30 | R = corrcoef(x,y) 31 | 32 | -------------------------------------------------------------------------------- /matlab code/Encryption_Decryption_total_process.m: -------------------------------------------------------------------------------- 1 | clc; 2 | clear all; 3 | %3D chaotic map for image encryption 4 | %3.53=1) %shift left of row 79 | sh_row(i,j-k(i))=rgb(i,j); 80 | row_shift_odd(i,j)=j-k(i); 81 | else 82 | sh_row(i,(col+j-k(i)))=rgb(i,j); 83 | row_shift_odd(i,j)=col+j-k(i); 84 | end 85 | end 86 | end 87 | end 88 | 89 | 90 | for j=1:1:col 91 | for i=1:1:row 92 | if(mod(l(j),2)==0) 93 | if((i-l(j))>=1) %shift up of column 94 | sh_col(i-l(j),j)=sh_row(i,j); 95 | col_shift_even(i,j)=i-l(j); 96 | else 97 | sh_col((row+i-l(j)),j)=sh_row(i,j); 98 | col_shift_even(i,j)=row+i-l(j); 99 | end 100 | else 101 | if((i+l(j))<=row) %shift down of column 102 | sh_col(i+l(j),j)=sh_row(i,j); 103 | col_shift_odd(i,j)=i+l(j); 104 | else 105 | sh_col((i+l(j)-row),j)=sh_row(i,j); 106 | col_shift_odd(i,j)=(i+l(j)-row); 107 | end 108 | end 109 | end 110 | end 111 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 112 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%XOR IMAGE%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 113 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 114 | total_length=row*col; 115 | column_image=reshape(sh_col,1,total_length); 116 | for i=1:1:total_length 117 | xorr1(1,i)=bitxor(column_image(i),m(i)); 118 | end 119 | y=reshape(xorr1,row,col); 120 | imwrite(y, 'encypted_peppers.jpg', 'Quality', 100); 121 | figure 122 | subplot(3,2,1) 123 | imshow(rgb) 124 | title('Original Image'); 125 | subplot(3,2,2) 126 | imhist(rgb) 127 | title('Histogram of original Image'); 128 | 129 | subplot(3,2,3) 130 | imshow(y) 131 | title('Encrypted Image'); 132 | subplot(3,2,4) 133 | imhist(y) 134 | title('Histogram of Encrypted Image'); 135 | 136 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 137 | %%%%%%%%%%%%%%%%%%%Decryption XOR%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 138 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 139 | [row,col]=size(y); 140 | rgb=y; 141 | total_length=row*col; 142 | column_image=reshape(rgb,1,total_length); 143 | for i=1:1:total_length 144 | xorr1(1,i)=bitxor(column_image(i),m(i)); 145 | end 146 | shuffled_image=reshape(xorr1,row,col); 147 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 148 | % IF k is even right shift row else left shift row%%%%%%%%%%%%%%%%% 149 | % If l is even shift up column else down shift column%%%%%%%%%%%%%% 150 | %%%%%%%%%%%%%%%%%%%ROTATION OPERATION%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 151 | %%%%%%%%%%%%ROW SHIFTING%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 152 | for j=1:1:col 153 | for i=1:1:row 154 | if(mod(l(j),2)==0) 155 | if((i+l(j))<=row) %shift down of column 156 | sh_col(i+l(j),j)=shuffled_image(i,j); 157 | col_shift_even(i,j)=i+l(j); 158 | else 159 | sh_col((i+l(j)-row),j)=shuffled_image(i,j); 160 | col_shift_even(i,j)=(i+l(j)-row); 161 | end 162 | else 163 | if((i-l(j))>=1) %shift up of column 164 | sh_col(i-l(j),j)=shuffled_image(i,j); 165 | col_shift_odd(i,j)=i-l(j); 166 | else 167 | sh_col((row+i-l(j)),j)=shuffled_image(i,j); 168 | col_shift_odd(i,j)=row+i-l(j); 169 | end 170 | end 171 | end 172 | end 173 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 174 | 175 | 176 | for i=1:1:row 177 | for j=1:1:col 178 | if(mod(k(i),2)==0) 179 | if((j-k(i))>=1) %shift left of row 180 | sh_row(i,j-k(i))=sh_col(i,j); 181 | row_shift_even(i,j)=j-k(i); 182 | else 183 | sh_row(i,(col+j-k(i)))=sh_col(i,j); 184 | row_shift_even(i,j)=col+j-k(i); 185 | end 186 | else 187 | if((j+k(i))<=col) %shift right of row 188 | sh_row(i,j+k(i))=sh_col(i,j); 189 | row_shift_even(i,j)=j+k(i); 190 | else 191 | sh_row(i,(j+k(i)-col))=sh_col(i,j); 192 | row_shift_even(i,j)=(j+k(i)-col); 193 | end 194 | end 195 | end 196 | end 197 | 198 | 199 | subplot(3,2,5) 200 | imshow (sh_row) 201 | title('decrypted image'); 202 | 203 | subplot(3,2,6) 204 | imhist(sh_row) 205 | title('histogram decrypted image'); 206 | 207 | imwrite(sh_row, 'Decrypted_peppers.jpg', 'Quality', 100); 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | -------------------------------------------------------------------------------- /matlab code/Entrophy_analysis.m: -------------------------------------------------------------------------------- 1 | clc; 2 | clear all; 3 | original=imread('encypted_peppers.jpg'); 4 | %rgb=rgb2gray(original); 5 | rgb=original; 6 | [row,col]=size(rgb); 7 | 8 | total_length=row*col; 9 | frequency=zeros(1,256); 10 | row_matrix_image=reshape(rgb,1,total_length); 11 | for i=1:1:total_length 12 | if(row_matrix_image(1,i)>0) 13 | frequency(1,row_matrix_image(1,i))=frequency(1,row_matrix_image(1,i))+1; 14 | else 15 | frequency(1,(row_matrix_image(1,i)+1))=frequency(1,(row_matrix_image(1,i)+1))+1; 16 | end 17 | end 18 | for i=1:1:256 19 | probability(1,i)=frequency(1,i)/total_length; 20 | if(probability(1,i)~=0) 21 | probability_enhance(1,i)=((-1)*probability(1,i)*log2(probability(1,i))); 22 | else 23 | probability_enhance(1,i)=probability(1,i); 24 | end 25 | end 26 | entropy=0; 27 | for i=1:1:256 28 | entropy=entropy+probability_enhance(i); 29 | end 30 | entropy 31 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 32 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 33 | -------------------------------------------------------------------------------- /matlab code/Histogram_Analysis.m: -------------------------------------------------------------------------------- 1 | clc; 2 | clear all; 3 | 4 | 5 | a=imread('Decrypted_lena.jpg'); 6 | b=imread('Decrypted_deblur.jpg'); 7 | c=imread('Decrypted_mandrill.jpg'); 8 | d=imread('Decrypted_peppers.jpg'); 9 | 10 | w=imread('encypted_lena.jpg'); 11 | x=imread('encypted_deblur.jpg'); 12 | y=imread('encypted_mandrill.jpg'); 13 | z=imread('encypted_peppers.jpg'); 14 | 15 | 16 | figure 17 | subplot(3,2,1) 18 | imhist(a); 19 | title('Histogram of lena image'); 20 | xlabel('(a)') 21 | 22 | subplot(3,2,2) 23 | imhist(w); 24 | title('Histogram of encrypted lena image'); 25 | xlabel('(b)') 26 | 27 | subplot(3,2,3) 28 | imhist(b); 29 | title('Histogram of deblur image'); 30 | xlabel('(c)') 31 | 32 | subplot(3,2,4) 33 | imhist(x); 34 | title('Histogram of encrypted deblur image'); 35 | xlabel('(d)') 36 | 37 | subplot(3,2,5) 38 | imhist(c); 39 | title('Histogram of mandrill image'); 40 | xlabel('(e)') 41 | 42 | subplot(3,2,6) 43 | imhist(y); 44 | title('Histogram of encrypted mandrill image'); 45 | xlabel('(f)') 46 | 47 | % 48 | % figure 49 | % imhist(c); 50 | % title('Histogram of mandrill image'); 51 | % figure 52 | % imhist(y); 53 | % title('Histogram of encrypted mandrill image'); 54 | % 55 | % figure 56 | % imhist(d); 57 | % title('Histogram of peppers image'); 58 | % figure 59 | % imhist(z); 60 | % title('Histogram of encrypted peppers image'); 61 | 62 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /matlab code/Image_show.m: -------------------------------------------------------------------------------- 1 | clc; 2 | clear all; 3 | w=imread('Decrypted_lena.jpg'); 4 | x=imread('Decrypted_deblur.jpg'); 5 | a=imread('Decrypted_mandrill.jpg'); 6 | 7 | y=imread('encypted_lena.jpg'); 8 | z=imread('encypted_deblur.jpg'); 9 | b=imread('encypted_mandrill.jpg'); 10 | 11 | figure 12 | subplot(2,2,1) 13 | imshow(w); 14 | title('Lena Image') 15 | xlabel('(a)') 16 | 17 | subplot(2,2,2) 18 | imshow(y); 19 | title('Encrypted Lena Image') 20 | xlabel('(b)') 21 | 22 | subplot(2,2,3) 23 | imshow(x); 24 | title('Deblur Image') 25 | xlabel('(c)') 26 | 27 | subplot(2,2,4) 28 | imshow(z); 29 | title('Encrypted Deblur Image') 30 | xlabel('(d)') 31 | % 32 | % subplot(3,2,5) 33 | % imshow(a); 34 | % title('Mandrill Image') 35 | % xlabel('(c)') 36 | % 37 | % subplot(3,2,6) 38 | % imshow(b); 39 | % title('Enc. Mandrill Image') 40 | % xlabel('(d)') 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /matlab code/Key_Sensitivity_analysis.m: -------------------------------------------------------------------------------- 1 | clc; 2 | clear all; 3 | %3D chaotic map for image encryption 4 | %3.53=1) %shift left of row 79 | sh_row(i,j-k(i))=rgb(i,j); 80 | row_shift_odd(i,j)=j-k(i); 81 | else 82 | sh_row(i,(col+j-k(i)))=rgb(i,j); 83 | row_shift_odd(i,j)=col+j-k(i); 84 | end 85 | end 86 | end 87 | end 88 | 89 | 90 | for j=1:1:col 91 | for i=1:1:row 92 | if(mod(l(j),2)==0) 93 | if((i-l(j))>=1) %shift up of column 94 | sh_col(i-l(j),j)=sh_row(i,j); 95 | col_shift_even(i,j)=i-l(j); 96 | else 97 | sh_col((row+i-l(j)),j)=sh_row(i,j); 98 | col_shift_even(i,j)=row+i-l(j); 99 | end 100 | else 101 | if((i+l(j))<=row) %shift down of column 102 | sh_col(i+l(j),j)=sh_row(i,j); 103 | col_shift_odd(i,j)=i+l(j); 104 | else 105 | sh_col((i+l(j)-row),j)=sh_row(i,j); 106 | col_shift_odd(i,j)=(i+l(j)-row); 107 | end 108 | end 109 | end 110 | end 111 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 112 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%XOR IMAGE%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 113 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 114 | total_length=row*col; 115 | column_image=reshape(sh_col,1,total_length); 116 | for i=1:1:total_length 117 | xorr1(1,i)=bitxor(column_image(i),m(i)); 118 | end 119 | yy=reshape(xorr1,row,col); 120 | imwrite(yy, 'encypted_lena.jpg', 'Quality', 100); 121 | % subplot(3,2,1) 122 | % imshow(rgb) 123 | % title('Original Image'); 124 | % subplot(3,2,2) 125 | % imhist(rgb) 126 | % title('Histogram of original Image'); 127 | figure('Name','Simulation of key sensitivity','NumberTitle','off') 128 | subplot(2,2,1) 129 | imshow(yy) 130 | title('Encrypted Lena Image using K1'); 131 | xlabel('(a)') 132 | 133 | subplot(2,2,2) 134 | imhist(yy) 135 | title('Histogram of Encrypted Lena Image using K1'); 136 | xlabel('(b)') 137 | 138 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 139 | %%%%%%%%%%%%%%%%%%%% 3D CHAOS GENERATION CODE%%%%%%%%%%%%%%%%%%%%%% 140 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 141 | clc; 142 | clear x; 143 | clear y; 144 | clear z; 145 | clear a; 146 | clear b; 147 | clear l; 148 | 149 | x(1)=0.2350+0.0000000000000001; 150 | y(1)=0.3500; 151 | z(1)=0.7350; 152 | a(1)=0.0125; 153 | b(1)=0.0157; 154 | l(1)=3.7700; 155 | image_height=256; 156 | for i=1:1:70000 157 | x(i+1)=l*x(i)*(1-x(i))+b*y(i)*y(i)*x(i)+a*z(i)*z(i)*z(i); 158 | y(i+1)=l*y(i)*(1-y(i))+b*z(i)*z(i)*y(i)+a*x(i)*x(i)*x(i); 159 | z(i+1)=l*z(i)*(1-z(i))+b*x(i)*x(i)*z(i)+a*y(i)*y(i); 160 | end 161 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 162 | %%%%%%histogram equalization and preparation for use%%%%%%%%%%%%%% 163 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 164 | x=ceil(mod((x*100000),image_height)); 165 | y=ceil(mod((y*100000),image_height)); 166 | z=ceil(mod((z*100000),image_height)); 167 | 168 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 169 | %%%%%%%%%%%%%%%%%INITIALIZE THE VALUE OF ROTATION%%%%%%%%%%%%%%%%% 170 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 171 | n=500; 172 | p=600; 173 | q=700; 174 | for j=1:1:row 175 | k(j)=x(j+n); 176 | l(j)=y(j+p); 177 | end 178 | 179 | % for i=1:1:row 180 | % k(i)=x(i+n); 181 | % end 182 | % for j=1:1:col 183 | % l(j)=y(j+p); 184 | % end 185 | 186 | for j=1:1:col*row 187 | m(j)=z(j+q); 188 | end 189 | 190 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 191 | %%%%%%%%%%%%%%%%%%%Decryption XOR%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 192 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 193 | [row,col]=size(yy); 194 | rgb=yy; 195 | total_length=row*col; 196 | column_image=reshape(rgb,1,total_length); 197 | for i=1:1:total_length 198 | xorr1(1,i)=bitxor(column_image(i),m(i)); 199 | end 200 | shuffled_image=reshape(xorr1,row,col); 201 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 202 | % IF k is even right shift row else left shift row%%%%%%%%%%%%%%%%% 203 | % If l is even shift up column else down shift column%%%%%%%%%%%%%% 204 | %%%%%%%%%%%%%%%%%%%ROTATION OPERATION%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 205 | %%%%%%%%%%%%ROW SHIFTING%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 206 | for j=1:1:col 207 | for i=1:1:row 208 | if(mod(l(j),2)==0) 209 | if((i+l(j))<=row) %shift down of column 210 | sh_col(i+l(j),j)=shuffled_image(i,j); 211 | col_shift_even(i,j)=i+l(j); 212 | else 213 | sh_col((i+l(j)-row),j)=shuffled_image(i,j); 214 | col_shift_even(i,j)=(i+l(j)-row); 215 | end 216 | else 217 | if((i-l(j))>=1) %shift up of column 218 | sh_col(i-l(j),j)=shuffled_image(i,j); 219 | col_shift_odd(i,j)=i-l(j); 220 | else 221 | sh_col((row+i-l(j)),j)=shuffled_image(i,j); 222 | col_shift_odd(i,j)=row+i-l(j); 223 | end 224 | end 225 | end 226 | end 227 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 228 | 229 | 230 | for i=1:1:row 231 | for j=1:1:col 232 | if(mod(k(i),2)==0) 233 | if((j-k(i))>=1) %shift left of row 234 | sh_row(i,j-k(i))=sh_col(i,j); 235 | row_shift_even(i,j)=j-k(i); 236 | else 237 | sh_row(i,(col+j-k(i)))=sh_col(i,j); 238 | row_shift_even(i,j)=col+j-k(i); 239 | end 240 | else 241 | if((j+k(i))<=col) %shift right of row 242 | sh_row(i,j+k(i))=sh_col(i,j); 243 | row_shift_even(i,j)=j+k(i); 244 | else 245 | sh_row(i,(j+k(i)-col))=sh_col(i,j); 246 | row_shift_even(i,j)=(j+k(i)-col); 247 | end 248 | end 249 | end 250 | end 251 | 252 | subplot(2,2,3) 253 | imshow(sh_row) 254 | title('Decrypted Lena Image using K2'); 255 | xlabel('(c)') 256 | 257 | subplot(2,2,4) 258 | imhist(sh_row) 259 | title('Histogram of Decrypted Lena Image using K2'); 260 | xlabel('(d)') 261 | 262 | 263 | imwrite(sh_row, 'Decrypted_lena.jpg', 'Quality', 100); 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | -------------------------------------------------------------------------------- /matlab code/NPCR_UACI_total.m: -------------------------------------------------------------------------------- 1 | clc; 2 | clear all; 3 | %3D chaotic map for image encryption 4 | %3.53=1) %shift left of row 79 | sh_row(i,j-k(i))=rgb(i,j); 80 | row_shift_odd(i,j)=j-k(i); 81 | else 82 | sh_row(i,(col+j-k(i)))=rgb(i,j); 83 | row_shift_odd(i,j)=col+j-k(i); 84 | end 85 | end 86 | end 87 | end 88 | 89 | 90 | for j=1:1:col 91 | for i=1:1:row 92 | if(mod(l(j),2)==0) 93 | if((i-l(j))>=1) %shift up of column 94 | sh_col(i-l(j),j)=sh_row(i,j); 95 | col_shift_even(i,j)=i-l(j); 96 | else 97 | sh_col((row+i-l(j)),j)=sh_row(i,j); 98 | col_shift_even(i,j)=row+i-l(j); 99 | end 100 | else 101 | if((i+l(j))<=row) %shift down of column 102 | sh_col(i+l(j),j)=sh_row(i,j); 103 | col_shift_odd(i,j)=i+l(j); 104 | else 105 | sh_col((i+l(j)-row),j)=sh_row(i,j); 106 | col_shift_odd(i,j)=(i+l(j)-row); 107 | end 108 | end 109 | end 110 | end 111 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 112 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%XOR IMAGE%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 113 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 114 | total_length=row*col; 115 | column_image=reshape(sh_col,1,total_length); 116 | for i=1:1:total_length 117 | xorr1(1,i)=bitxor(column_image(i),m(i)); 118 | end 119 | y=reshape(xorr1,row,col); 120 | imwrite(y, 'encypted_peppers1.jpg', 'Quality', 100); 121 | 122 | 123 | 124 | clc; 125 | clear all; 126 | %3D chaotic map for image encryption 127 | %3.53=1) %shift left of row 202 | sh_row(i,j-k(i))=rgb(i,j); 203 | row_shift_odd(i,j)=j-k(i); 204 | else 205 | sh_row(i,(col+j-k(i)))=rgb(i,j); 206 | row_shift_odd(i,j)=col+j-k(i); 207 | end 208 | end 209 | end 210 | end 211 | 212 | 213 | for j=1:1:col 214 | for i=1:1:row 215 | if(mod(l(j),2)==0) 216 | if((i-l(j))>=1) %shift up of column 217 | sh_col(i-l(j),j)=sh_row(i,j); 218 | col_shift_even(i,j)=i-l(j); 219 | else 220 | sh_col((row+i-l(j)),j)=sh_row(i,j); 221 | col_shift_even(i,j)=row+i-l(j); 222 | end 223 | else 224 | if((i+l(j))<=row) %shift down of column 225 | sh_col(i+l(j),j)=sh_row(i,j); 226 | col_shift_odd(i,j)=i+l(j); 227 | else 228 | sh_col((i+l(j)-row),j)=sh_row(i,j); 229 | col_shift_odd(i,j)=(i+l(j)-row); 230 | end 231 | end 232 | end 233 | end 234 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 235 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%XOR IMAGE%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 236 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 237 | total_length=row*col; 238 | column_image=reshape(sh_col,1,total_length); 239 | for i=1:1:total_length 240 | xorr1(1,i)=bitxor(column_image(i),m(i)); 241 | end 242 | y=reshape(xorr1,row,col); 243 | imwrite(y, 'encypted_peppers2.jpg', 'Quality', 100); 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | -------------------------------------------------------------------------------- /matlab code/NPCR_only.m: -------------------------------------------------------------------------------- 1 | clc; 2 | clear all; 3 | 4 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 5 | %%%%%%%%%%%%%%%%%%%%%%NPCR%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 6 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 7 | 8 | x=imread('encypted_peppers1.jpg'); 9 | y=imread('encypted_peppers2.jpg'); 10 | [row,col]=size(x); 11 | count=0; 12 | for i=1:1:row 13 | for j=1:1:col 14 | if(x(i,j)==y(i,j)) 15 | count=count+0; 16 | else 17 | count=count+1; 18 | end 19 | end 20 | end 21 | 22 | npcr=(count/(row*col))*100 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /matlab code/UACI_only.m: -------------------------------------------------------------------------------- 1 | clc; 2 | clear all; 3 | 4 | x=imread('encypted_deblur1.jpg'); 5 | y=imread('encypted_deblur2.jpg'); 6 | [row,col]=size(x); 7 | count=zeros(row,col); 8 | for i=1:1:row 9 | for j=1:1:col 10 | if(x(i,j)>y(i,j)) 11 | count(i,j)=(x(i,j)-y(i,j)); 12 | else 13 | count(i,j)=(y(i,j)-x(i,j)); 14 | end 15 | end 16 | end 17 | 18 | count=count/255; 19 | countt=0; 20 | for i=1:1:row 21 | for j=1:1:col 22 | countt=countt+count(i,j); 23 | end 24 | end 25 | 26 | uaci=(countt/(row*col))*100 27 | -------------------------------------------------------------------------------- /matlab code/logistic_map_analysis.m: -------------------------------------------------------------------------------- 1 | clc; 2 | clear all; 3 | %3D chaotic map for image encryption 4 | %3.53