# A Simple Image Encryption Based on Binary Image Affine Transformation and Zigzag Process

Authors: Adélaïde Nicole Kengnou Telem; Cyrille Feudjio; Balamurali Ramakrishnan; Hilaire Bertrand Fotsin; Karthikeyan Rajagopal
Journal: Complexity
 (2022)

---

## Abstract

In this paper, we propose a new and simple method for image encryption. It uses an external secret key of 128 bits long and an internal secret key. The novelties of the proposed encryption process are the methods used to extract an internal key to apply the zigzag process, affine transformation, and substitution-diffusion process. Initially, an original gray-scale image is converted into binary images. An internal secret key is extracted from binary images. The two keys are combined to compute the substitution-diffusion keys. The zigzag process is firstly applied on each binary image. Using an external key, every zigzag binary image is reflected or rotated and a new gray-scale image is reconstructed. The new image is divided into many nonoverlapping subblocks, and each subblock uses its own key to take out a substitution-diffusion process. We tested our algorithms on many biomedical and nonmedical images. It is seen from evaluation metrics that the proposed image encryption scheme provides good statistical and diffusion properties and can resist many kinds of attacks. It is an efficient and secure scheme for real-time encryption and transmission of biomedical images in telemedicine.


---

## Body

## 1. Introduction

The amazing developments in the field of network communications during the past years have created a great requirement for secured image transmission over the Internet [1]. Image data, such as medical images, military images, images of electronic publishing, and fingerprint images from authentication systems, must be kept private and confidential. The confidentiality of these images is capital and cannot be guaranteed through the Internet. To ensure the security of information during transmission, encryption techniques are used. Cryptography aims to ensure data confidentiality, integrity, and authentication during communication. In telemedicine, medical data need to be processed with total discretion. This justifies the use of encryption technology in telemedicine.Cryptographic methods are based on two fundamental principles, namely, substitution and diffusion. Substitution involves replacing certain letters or values of the original message with others. Diffusion consists of dispersing the position of the letters or the values of the original message to scramble the message. Most encryption techniques have been developed to secure text data. Unfortunately, these techniques are not suitable for images because the images have a rather complex structure and are quite large in size compared to the text data. Yet, the images may contain private and fairly confidential information. Hence, there is a need to find an effective technique to secure images. Thus, designing less complex image encryption algorithms becomes very crucial. Much research has focused on the issue of image security. Digital images have several properties such as information redundancy, a strong correlation between pixels, and large data capacities. An image encryption algorithm must take into account all these properties.Conventional image encryption techniques are divided into two groups, namely, asymmetric encryption (with private and public keys) and symmetric encryption (with a secret key) [2]. Several algorithms have been proposed in the past for the encryption of images. We have data encryption standard (DES), triple data encryption algorithm (TDEA), advanced encryption standard (AES), Rivest, Shamir, and Adleman (RSA), and fast image encryption algorithm (FEAL) [2–8]. In recent years, chaotic systems have been used by many researchers in image encryption. A chaos-based image encryption technique typically uses both substitution and diffusion processes. This technique generally uses an external key and one or more generators to generate chaotic sequences that will be used for the substitution/diffusion process. Ahmad and Farooq in [9] approved that the generation of high-quality key stream decides the level of security offered by the Cipher. They combined the simple logistic map with the cubic map to generate PN sequences for the proposed encryption scheme. Those PN sequences from the proposed generator have good autocorrelation and have been tested randomness. Li et al. in [10] introduced a performance-enhanced image encryption scheme based on depth-conversion integral imaging and hybrid cellular automata (CA). The aim is to meet the requirements of secured image transmission. The input image is firstly decomposed into an elemental image array (EIA) using the depth-converted integral imaging technique. The CA model and chaotic sequence are used to encrypt the elemental images. In [11], Ahmad et al. used particle swarm optimization and chaotic map to propose an optimized image encryption. Initial conditions of the chaotic map depend on the pending plain image, so the algorithm is resistant because, from one image to another, key stream will be different. Niu et al. in [12] proposed an efficient method for image encryption based on the chaos theory and a deoxyribonucleic acid (DNA) sequence database using the characteristics of chaos, such as randomness, regularity, ergodicity, and initial value sensitiveness, combined with the unique space conformation of DNA molecules and their unique information storage and processing ability. In [13], Kengnou et al. proposed an encryption algorithm using a 3D chaotic system and DNA coding. Two keys are used, an internal one and an external one. During the chaotic process, the sequences generated from the different variables of the chaotic generator are not used separately. They are combined using the zigzag process and used simultaneously. Each 3D chaotic system can be used. Twenty four DNA rules and 16 join operations of DNA coding are used during the DNA coding process. A Fast Walsh Transform (FWT) has been combined with two chaotic logistic maps by Telem et al. in [14] to propose a new scheme of image encryption. Chaotic encryption methods are combined with the two-dimensional FWT of images. Liu and Miao in [15] proposed an image encryption method based on a logistic chaotic map and dynamical algorithm. In their method, the parameter of the logistic map is varied and used to shuffle the plain image. Then, the dynamical algorithm comes to encrypt the image. Many other chaotic encryption methods have been proposed in [15–23].Cryptanalysis evaluates the efficiency of cryptosystems to resist against attacks and therefore confirms their validity. Several studies have shown that some cryptosystems based on chaos could be cryptanalyzed [24–27]. To face this challenge, Pareek et al. in [28] proposed an image encryption system without chaos. From a 128-bit external key, it provides an efficient algorithm using 16 rounds with satisfactory results. In [29], Jolfaei et al. have demonstrated the shortcomings of the image encryption scheme proposed by Pareek et al. [28]. The method is not secured, and the secret key can be deduced by a chosen-ciphertext attack. Security flaws of the encryption scheme have been discussed and solutions have been proposed in [29]. Houas et al. proposed in [30] a new algorithm to encrypt binary images based on several steps. Firstly, they reduced the amount of data required to present the image. The next step consists to divide the image into d blocks. Those blocks are used to construct a new image of the same size as the original one but represented on a new basis. The construction of the new basis is inspired by the work of Mokhtari and Melkemi [31]. After that transformation, they obtained a key image and used it to encrypt and decrypt images. The encrypted image is the representation on a new basis. The decryption algorithm consists of subtraction between each encrypted image and the key image and the sum of them.Some image encryption methods are based on mathematical transform such as cosine transform, and Fourier transform is proposed. The method proposed by Lima et al. in [32] is based on the cosine number transform (CNT), a mathematical tool whose application requires modular arithmetic only. A CNT is very sensitive to changes in the vector being transformed, so 2 slightly different vectors may have significantly distinct CNTs, which are desirable for cryptography applications [32]. The method consists of dividing an image into blocks that overlap horizontally and vertically the corresponding adjacent block. The blocks are then sequentially taken and submitted to the recursive computation of a two-dimensional CNT. The method is limited to noncompressed images and particularly to medical images complying with the Digital Imaging and Communications in Medicine (DICOM) standard. Lima et al. in [33] proposed a fast computation of Cosine transform over fields of characteristic 2 and the application to image encryption. Annaby et al. in [34] have proposed a cryptosystem based on Fourier transform.In [35–38], methods to reduce the workload of the time-consuming diffusion part are proposed. The encryption process is taken over the entire image. The image is not divided into many subblocks. Those methods gain in execution time but have several security problems.In [39–41], affine transformations combined with other mathematical functions have been used to propose image encryption methods. Zhu et al. [39] have used affine cipher and generalized Arnold map to propose an image encryption scheme. Ahmad and Hwang in [40] have combined affine transformation with the chaotic map to propose their encryption method. In [41], Shah et al. have combined affine transformation with linear fractional transformation.In this work, affine transformations are not combined with other mathematical models or functions. We propose a new image encryption algorithm using an external key, an internal key, affine transformations (reflections and rotations), zigzag process, and substitution-diffusion processes. Each pixel of the plain image is converted into its equivalent 8-bit binary, and the bits of rankn (n = 1, 2, 3, 4, 5, 6, 7, 8) of the different pixels constitute the binary image of this rank. So, the plain image is converted into 8 binary images. From binary images, an internal key is deduced. Each binary image is submitted to the zigzag process to yield zigzag binary images. Using an external key, the zigzag binary images are mapped using affine transformations and a new image is reconstructed. The reconstructed image is then submitted to substitution and diffusion processes to produce a cipher image. The novelties of this work are(i)
The use of the two keys: an internal key is extracted from the binary components of the plain image to be encrypted. In [13], an internal key is extracted directly from the pixel of plain image and not from the binary components of the plain image. In this work, an internal key is used in combination with the external key to generate the substitution and diffusion sequences. Internal keys are different from one plain image to another, and consequently, the substitution and diffusion sequences are also different even in the case of the same external key. To decrypt the cipher image, one must have the exact internal key and external key and well-known algorithm used in the cryptosystem.(ii)
The proposed algorithm does not use chaotic generators or complex mathematic functions to compute the substitution-diffusion sequences. Rather, those sequences are computed from simple logical bit operation by using external and internal keys and the part of the previous result of the encryption process.(iii)
The application of affine transformation on the binary component of the plain image.(iv)
The method to apply zigzag process: depending on the context, it can act as a diffusion or substitution process. Previous works have applied the zigzag process on the gray-scale image. The proposed method applied the zigzag process on the binary version of the plain image. So, it acts as a substitution process.Hence, the proposed method does not gain on execution time but gain more on efficiency, security, and robustness. The proposed method is very helpful in telemedicine to secure medical images before transmitting them from one hospital to another. The method can also be used in every domain where we need to secure images as military domain and so on.In the rest of the work, we present the details of our encryption algorithm in Section2. The experimental results and security analysis tests are given in Section 3. At the end of the work is a conclusion.


## 2. Proposed Cryptosystem

### 2.1. Block Diagram of the Proposed Algorithm

In this work, we used an external key of 128 bits long, an internal key, reflection and rotation mappings, zigzag process, substitution, and diffusion processes to propose a new image encryption method. The plain image is converted into 8 binary images. From binary images, an internal key is extracted. Each binary image is submitted to the zigzag process to yield zigzag binary images. Using an external key, the zigzag binary images are mapped and a new image is reconstructed. This new image is divided into nonoverlapping squared subblocks. Each subblock is then submitted to the substitution and diffusion processes for K round using the combination of the two keys. The originality of this method dwells on the method used to generate the internal key, the use of reflection or rotation mapping, and the method to apply the substitution and the zigzag processes, the method used to compute substitution and diffusion sequences. The internal key is provided by the image being encrypted. In [28], the zigzag operation is applied on the pixel values, and it acts to change just the position of the pixel or the pixel location in the subblock. In this work, the whole image or the considered subblock is converted into binary images or binary subblock. The bits in a binary image/subblock are then reshuffled within the image/block by a zigzag path, and a new image/subblock is reconstructed. Consequently, the zigzag process changes the value of the pixels and acts as a substitution process. After the zigzag process, an external key is used to choose the corresponding type of transformation to be applied on each zigzag binary image. In [39–41], authors combine affine transformations with other mathematical models or functions. In this work, we do not use any chaotic generator or mathematical function to generate the codes used for the substitution-diffusion processes as usually. Rather, we combine the two keys (internal and external) and pixels of the image to compute the codes used on substitution-diffusion processes. Those features are the particularities of this algorithm. The block diagram of the proposed algorithm is shown in Figure 1.Figure 1
The block diagram of our proposed algorithm.


#### 2.1.1. External and Internal Keys

The proposed algorithm uses an external secret key of thirty-two hexadecimal numbers as shown in this example: «ABCDEFGHIJKLMNOPRSTUVWαβγηθλξρτφ». This key is used for both substitution-diffusion processes and the choice of the type of affine transformation to be applied on binary images. An original image Imxn is decomposed into 8 binary images Ibimxn (i = 1, 2, …, 8). Ibimxn are submitted to “XOR” operation and yield one binary matrix. This matrix is then converted into a pixel matrix. The “XOR” operations between lines of the matrix produce the first part of the internal key named “keyi1,” and while the “XOR” operations between columns produce the second part of the internal key named “keyi2.” Table 1 presents the internal keys of two images ‘ANTAMOEBACOLI’ and ‘Lena,’ respectively. One can see the difference between the two internal keys. So, internal keys are different from image to another. “keyi1” and “keyi2” are combined with an external key to generate substitution-diffusion sequences, and consequently, substitution-diffusion sequences are also different for one image to another, and this makes the algorithm high secured and resistant against attacks.Table 1
Internal keys of two images: ANTAMOEBACOLI and ‘Lena.’
78188117104223128201731631498817717520020226129697614081116102113169172481859532213165642172521931821064044510169209255631819217424813024312029157150246462451346217414215834176210111521562785054715522066248451941648970238221204565758432231046724914323425550515253546061207646568707255565758596061627374757677798081Keyi1 of ANTAMOEBACOLI imageKeyi2 of ANTAMOEBACOLI image1389723215316285200238115471601079422461529424523118350172131861201024876237842461542532305311825520259218772551681142017620453117195102643911225133143117023275791567811915469206739524244189514014714110118412791452112210117663211100106221879813124178108103208216313090190168051381448981582242423723912611210180208171142341992212882Keyi1 of lena imageKeyi2 of lena image


#### 2.1.2. Zigzag Process

The zigzag process aims to scramble the image by changing the position of the pixel or the bit. Depending on the context, it can act as a diffusion or substitution process. In this algorithm, the zigzag process applied to the whole binary image acts as a diffusion process. In the case of the binary subblock, it acts as a substitution process. A zigzag process to scramble the binary images is shown in Figure2.Figure 2
A zigzag path to scramble the binary subblock.


#### 2.1.3. Affine Transformation Process

On the Euclidean plane, letw:R2⟶R2 be an affine transformation; its equation is given by(1)wx,y=ax+by+e,cx+dy+f=x′,y′,where x,y is the coordinate point, a,b,c,d,e, and f are real numbers, and x′,y′ is the new coordinate point. We can also write this same transformation with the equivalent notations:(2)wu=wxy=abcdxy+ef=x′y′=Au+T,where A is a 2×2 real matrix and T=ef represents translations.The matrixA can also be written in the form of(3)A=abcd=r1cosθ1−r2sinθ2r1sinθ1r2cosθ2,where r1,θ1 are the polar coordinates of the point a,c and r2,θ2+π/2 are the polar coordinates of the point (b, d). In other words,(4)r1=a2+c2,tanθ1=ca,r2=b2+d2,tanθ2=bd.Various transformations can be performed inR2 such as dilations, reflections, translations, rotations, and similitudes. In this work, we are restricted to reflection and rotation transformations.A reflection on thex-axis can be written in as wrxx,y=x,−y, while a reflection on the y-axis is written as wryx,y=−x,y. In matrix representation, these reflections are given by(5)x′,y′,wryu=−1001xy.A rotation mapping has the formwrx,y=xcosθ−ysinθ,xsinθ+ycosθ.Also, it is expressed as(6)wru=cosθ−sinθsinθcosθxy.For the rotation angleθ, 0≤θ<2π.The available reflection and rotation transformations are(0)
Identity (I):(1)
Orthogonal reflection around midvertical axis of block (Rmv)(2)
Orthogonal reflection around midhorizontal axis of block (Rmh)(3)
Orthogonal reflection around the first diagonal of block (Rfdiag)(4)
Orthogonal reflection around the second diagonal of block (Rsdiag)(5)
Rotation around the center of block +90° (R + 90)(6)
Rotation around the center of block +180°(R + 180)(7)
Rotation around the center of block −90°(R−90)In the algorithm step, we use zigzag binary matrices namedIbzimxn, i = 1, 2, …, 8. An external key is used to choose the corresponding type of transformation to be applied on each zigzag binary image Ibzimxn. Let «ABCDEFGHIJKLMNOPRSTUVWαβγηθλξρτφ» be an external key; to choose the corresponding affine transformations, we extract eight numbers «D, H, L, P, U,β, λ, φ» from an external key. Each number is converted into its corresponding octave number. The obtained octave number gives the corresponding transformation (from 0 to 7 as describe previously) to be applied on the corresponding zigzag binary image. An external key should be chosen such as all these obtained octave number must not be null. At the end of the affine transformation process, the transformed binary images are used to reconstruct a new gray-scale image Imxn′. This image Imxn′ is subdivided into nonoverlapping squared block before the substitution-diffusion process.


#### 2.1.4. Substitution Process

The operation is taken into two steps, zigzag operation and substitution, using the corresponding key. The chosen subblockSIkxk′ is converted into a binary subblock SbI′. The zigzag operation is taken on SbI′, and it is reconverted into the pixel value. A zigzag path to scramble the binary block is shown in Figure 2. The next step is to combine an external key with «keyi1» to generate the sequence which will be used for substitution operation. Let L be the size of a subblock. Having an external key «externalkey» and an internal key «substitutioncode», the algorithm to generate the sequence of each block is defined as follows:(a)
For the first round and the first subblock,Lon = length (keyi1);lng = Lon/2;codesub = keyi1;cc1 = bitxor (externalkey, codesubu (1 : lng));cc2 = bitxor (cc1, codesub ((lng + 1) : Lon));usingcode = [cc1 cc2];(b)
For the next round K and the other subblocks,codesubu = usingcode;c1 = bitxor (clefdecfin, codesubu ((lng + 1) : Lon));cc1 = bitxor (c1, vectsub (1 : 1 : lng));c2 = bitxor (cc1, codesubu (lng:−1 : 1));cc2 = bitxor (c2, vectsub ((lng + 1) : Lon));usingcode = [cc1 cc2];« vectsub » is the last result.The sequence «usigncode» will be used for the substitution process of the corresponding subblock. The second step of the substitution process is performed using «XOR» operation.


#### 2.1.5. Diffusion Process

The subblock coming from the substitution process is then sent through the permutation process. This process will modify the pixel location. The same algorithm used during the substitution process is used to generate the sequence for the diffusion process in which « keyi2» is used. The sequence of each subblock is rearranged in the ascending order and used to modify the position of the pixel in the subblock.


#### 2.1.6. The Overall Proposed Encryption Algorithm

LetImxn be an original image. We can describe our encryption algorithm as follows:Step 1: generate an external secret key.Step 2: convert imageIbimxn images.Step 3: extract an internal secret key.Step 4: apply zigzag process on binary images.Step 5: select and apply affine transformation on each zigzag binary images using the external key.Step 6: reconstruct a new gray-scale image using transformed zigzag binary images.Step 7: subdivide a new image into many nonoverlapping squared subblock.Step 8: for each subblock and forK round,Step 8.1: convert each pixel into the binary vector.Step 8.2: apply scan zigzag operation to permute the position of the binary element in the binary matrix.Step 8.3: reconstruct a gray-scale subblock.Step 8.4: combine an external key and an internal key to generate the substitution sequence of the subblock.Step 8.5: take out a second part of the substitution process.Step 8.6: combine an external key and an internal key to generate the permutation sequence of the subblock.Step 8.7: take out a diffusion process.The decryption algorithm is the inverse operations of the encryption process.


### 2.2. Evaluation Metrics

A robust and good cryptosystem should present many features. Firstly, the key space should be large enough to make the brute-force attack infeasible [17]. Secondly, the histograms of the cipher image should be uniformly distributed. The correlation between adjacent pixels (vertically, horizontally, and diagonally) in the cipher image should be approximately zero to confirm the effectiveness of the method.


#### 2.2.1. Correlation Coefficient

The correlation metric is used to evaluate the similarity between two images. If the images are identical, the correlation value is equal to one. When the correlation value is closed to zero, there is no similarity between these images. For an efficient encryption scheme, the correlation between plain image and cipher image must be close to zero. The correlation coefficient (Co) between original and encrypted images is defined as follows:(7)Co=Np∑j=1Npxj×yj−∑j=1Npxj×∑j=1NpyjNp∑j=1Npxj2−∑j=1Npxj2×Np∑j=1Npyj2−∑j=1Npyj2,where x and y are gray-scale pixel values of the original and encrypted images and Np is the total number of pixels.The correlation coefficientγ of each pair of adjacent pixels is calculated using [42](8)γx,y=covx,yDxDy,where(9)covx,y=1Nap∑i=1Napxi−Exyi−Ey,(10)Ex=1Nap∑i=1Napxi,(11)Dx=1Nap∑i=1Napxi−Ex2.In equations (8)–(11), x and y are the gray values of two adjacent pixels in the image and Nap is the total number of adjacent pairs of pixels. Ex is the expectation of variable x, Dx is the variance, and covx,y is the covariance of two adjacent pixels in the image. For a good cryptosystem, the correlation coefficient Co between plain and cipher images should be close to zero. Likewise, the correlation coefficient γ of each pair of adjacent pixels in the cipher image should be close to zero.


#### 2.2.2. Entropy Information

The information entropy, introduced by Shannon, is one of the most important features of randomness. It is used to evaluate the quantity of information in the image. Information entropyHs is calculated in [28] using(12)Hs=∑i=0Ngl−1Psilog21psi,where Ngl is the total number of gray levels in the image and Psi shows the probability of appearance of the symbol si. The entropy value of encrypted images should be closed to eight.The (k, TB)-local Shannon entropy with respect to local image blocks may be computed by the following steps [43]. First, nonoverlapping image blocks S1, S2, … Sk with TB pixels for a test image S are randomly selected. Then, information entropy H (Si) for all image blocks via equation (12) may be obtained. Finally, the local Shannon entropy over these k image blocks is computed using(13)Hk,TBm=∑i=1kHSik.


#### 2.2.3. Differential Attacks

The change of a single pixel on a plain image should have an important effect on the cipher image. Number of Pixels Change Rate (NPCR) and Unified Average Changing Intensity (UACI) are used to test the influence of changing a single pixel in the original image on the whole encrypted image [17]. Therefore, if Ai,j and Bi,j are the pixels in row i and column j of the encrypted images A and B, with only one-pixel difference between the respective plain images, then the NPCR is calculated by using the following formula [44]:(14)NPCR=∑i,jDi,jW×H×100%,where W and H are the width and height of A or B. Di,j is calculated as follows:(15)Di,j=1,ifAi,j≠Bi,j,0,otherwise.UACI is calculated by the following formula:(16)UACIA,B=1W×H∑i,jAi,j−Bi,j255×100%.The estimated score for NPCR and UACI are 99.6094% and 33.4635% for gray-scale images [45].


#### 2.2.4. Image Quality Criterion

After the encryption/decryption processes, we need to evaluate the performance of the cryptosystem and the quality of images. This is done by evaluating the mean square error (MSE), the peak signal-to-noise ratio, (PSNR) and the encryption quality.LetP and P′, respectively, be a plain image, an encrypted image, and a decrypted image. MSE is defined as follows:(17)MSE=∑m=1M∑n=1NPm,n−P′m,n2M×N,where M is the total number of lines in the image and N is the total number of columns. The PSNR is defined as follows:(18)PSNR=10Log102552MSE.When the decrypted imageP′ is identical to the plain one, MSE is zero, and consequently, PSNR is infinite.The total changes in pixels’ values between the plain image and the encrypted image allow to confirm the encryption quality. So, encryption quality gives us the average number of changes to each gray level between plain image and its corresponding encrypted image. It is defined as follows:(19)Encryption quality⇀=∑L255HLC−HLP256,where C denotes the encrypted image, L is the gray level, L=0,1,2,…255, and HL is the total number of occurrence of L in the image.


## 2.1. Block Diagram of the Proposed Algorithm

In this work, we used an external key of 128 bits long, an internal key, reflection and rotation mappings, zigzag process, substitution, and diffusion processes to propose a new image encryption method. The plain image is converted into 8 binary images. From binary images, an internal key is extracted. Each binary image is submitted to the zigzag process to yield zigzag binary images. Using an external key, the zigzag binary images are mapped and a new image is reconstructed. This new image is divided into nonoverlapping squared subblocks. Each subblock is then submitted to the substitution and diffusion processes for K round using the combination of the two keys. The originality of this method dwells on the method used to generate the internal key, the use of reflection or rotation mapping, and the method to apply the substitution and the zigzag processes, the method used to compute substitution and diffusion sequences. The internal key is provided by the image being encrypted. In [28], the zigzag operation is applied on the pixel values, and it acts to change just the position of the pixel or the pixel location in the subblock. In this work, the whole image or the considered subblock is converted into binary images or binary subblock. The bits in a binary image/subblock are then reshuffled within the image/block by a zigzag path, and a new image/subblock is reconstructed. Consequently, the zigzag process changes the value of the pixels and acts as a substitution process. After the zigzag process, an external key is used to choose the corresponding type of transformation to be applied on each zigzag binary image. In [39–41], authors combine affine transformations with other mathematical models or functions. In this work, we do not use any chaotic generator or mathematical function to generate the codes used for the substitution-diffusion processes as usually. Rather, we combine the two keys (internal and external) and pixels of the image to compute the codes used on substitution-diffusion processes. Those features are the particularities of this algorithm. The block diagram of the proposed algorithm is shown in Figure 1.Figure 1
The block diagram of our proposed algorithm.


### 2.1.1. External and Internal Keys

The proposed algorithm uses an external secret key of thirty-two hexadecimal numbers as shown in this example: «ABCDEFGHIJKLMNOPRSTUVWαβγηθλξρτφ». This key is used for both substitution-diffusion processes and the choice of the type of affine transformation to be applied on binary images. An original image Imxn is decomposed into 8 binary images Ibimxn (i = 1, 2, …, 8). Ibimxn are submitted to “XOR” operation and yield one binary matrix. This matrix is then converted into a pixel matrix. The “XOR” operations between lines of the matrix produce the first part of the internal key named “keyi1,” and while the “XOR” operations between columns produce the second part of the internal key named “keyi2.” Table 1 presents the internal keys of two images ‘ANTAMOEBACOLI’ and ‘Lena,’ respectively. One can see the difference between the two internal keys. So, internal keys are different from image to another. “keyi1” and “keyi2” are combined with an external key to generate substitution-diffusion sequences, and consequently, substitution-diffusion sequences are also different for one image to another, and this makes the algorithm high secured and resistant against attacks.Table 1
Internal keys of two images: ANTAMOEBACOLI and ‘Lena.’
78188117104223128201731631498817717520020226129697614081116102113169172481859532213165642172521931821064044510169209255631819217424813024312029157150246462451346217414215834176210111521562785054715522066248451941648970238221204565758432231046724914323425550515253546061207646568707255565758596061627374757677798081Keyi1 of ANTAMOEBACOLI imageKeyi2 of ANTAMOEBACOLI image1389723215316285200238115471601079422461529424523118350172131861201024876237842461542532305311825520259218772551681142017620453117195102643911225133143117023275791567811915469206739524244189514014714110118412791452112210117663211100106221879813124178108103208216313090190168051381448981582242423723912611210180208171142341992212882Keyi1 of lena imageKeyi2 of lena image


### 2.1.2. Zigzag Process

The zigzag process aims to scramble the image by changing the position of the pixel or the bit. Depending on the context, it can act as a diffusion or substitution process. In this algorithm, the zigzag process applied to the whole binary image acts as a diffusion process. In the case of the binary subblock, it acts as a substitution process. A zigzag process to scramble the binary images is shown in Figure2.Figure 2
A zigzag path to scramble the binary subblock.


### 2.1.3. Affine Transformation Process

On the Euclidean plane, letw:R2⟶R2 be an affine transformation; its equation is given by(1)wx,y=ax+by+e,cx+dy+f=x′,y′,where x,y is the coordinate point, a,b,c,d,e, and f are real numbers, and x′,y′ is the new coordinate point. We can also write this same transformation with the equivalent notations:(2)wu=wxy=abcdxy+ef=x′y′=Au+T,where A is a 2×2 real matrix and T=ef represents translations.The matrixA can also be written in the form of(3)A=abcd=r1cosθ1−r2sinθ2r1sinθ1r2cosθ2,where r1,θ1 are the polar coordinates of the point a,c and r2,θ2+π/2 are the polar coordinates of the point (b, d). In other words,(4)r1=a2+c2,tanθ1=ca,r2=b2+d2,tanθ2=bd.Various transformations can be performed inR2 such as dilations, reflections, translations, rotations, and similitudes. In this work, we are restricted to reflection and rotation transformations.A reflection on thex-axis can be written in as wrxx,y=x,−y, while a reflection on the y-axis is written as wryx,y=−x,y. In matrix representation, these reflections are given by(5)x′,y′,wryu=−1001xy.A rotation mapping has the formwrx,y=xcosθ−ysinθ,xsinθ+ycosθ.Also, it is expressed as(6)wru=cosθ−sinθsinθcosθxy.For the rotation angleθ, 0≤θ<2π.The available reflection and rotation transformations are(0)
Identity (I):(1)
Orthogonal reflection around midvertical axis of block (Rmv)(2)
Orthogonal reflection around midhorizontal axis of block (Rmh)(3)
Orthogonal reflection around the first diagonal of block (Rfdiag)(4)
Orthogonal reflection around the second diagonal of block (Rsdiag)(5)
Rotation around the center of block +90° (R + 90)(6)
Rotation around the center of block +180°(R + 180)(7)
Rotation around the center of block −90°(R−90)In the algorithm step, we use zigzag binary matrices namedIbzimxn, i = 1, 2, …, 8. An external key is used to choose the corresponding type of transformation to be applied on each zigzag binary image Ibzimxn. Let «ABCDEFGHIJKLMNOPRSTUVWαβγηθλξρτφ» be an external key; to choose the corresponding affine transformations, we extract eight numbers «D, H, L, P, U,β, λ, φ» from an external key. Each number is converted into its corresponding octave number. The obtained octave number gives the corresponding transformation (from 0 to 7 as describe previously) to be applied on the corresponding zigzag binary image. An external key should be chosen such as all these obtained octave number must not be null. At the end of the affine transformation process, the transformed binary images are used to reconstruct a new gray-scale image Imxn′. This image Imxn′ is subdivided into nonoverlapping squared block before the substitution-diffusion process.


### 2.1.4. Substitution Process

The operation is taken into two steps, zigzag operation and substitution, using the corresponding key. The chosen subblockSIkxk′ is converted into a binary subblock SbI′. The zigzag operation is taken on SbI′, and it is reconverted into the pixel value. A zigzag path to scramble the binary block is shown in Figure 2. The next step is to combine an external key with «keyi1» to generate the sequence which will be used for substitution operation. Let L be the size of a subblock. Having an external key «externalkey» and an internal key «substitutioncode», the algorithm to generate the sequence of each block is defined as follows:(a)
For the first round and the first subblock,Lon = length (keyi1);lng = Lon/2;codesub = keyi1;cc1 = bitxor (externalkey, codesubu (1 : lng));cc2 = bitxor (cc1, codesub ((lng + 1) : Lon));usingcode = [cc1 cc2];(b)
For the next round K and the other subblocks,codesubu = usingcode;c1 = bitxor (clefdecfin, codesubu ((lng + 1) : Lon));cc1 = bitxor (c1, vectsub (1 : 1 : lng));c2 = bitxor (cc1, codesubu (lng:−1 : 1));cc2 = bitxor (c2, vectsub ((lng + 1) : Lon));usingcode = [cc1 cc2];« vectsub » is the last result.The sequence «usigncode» will be used for the substitution process of the corresponding subblock. The second step of the substitution process is performed using «XOR» operation.


### 2.1.5. Diffusion Process

The subblock coming from the substitution process is then sent through the permutation process. This process will modify the pixel location. The same algorithm used during the substitution process is used to generate the sequence for the diffusion process in which « keyi2» is used. The sequence of each subblock is rearranged in the ascending order and used to modify the position of the pixel in the subblock.


### 2.1.6. The Overall Proposed Encryption Algorithm

LetImxn be an original image. We can describe our encryption algorithm as follows:Step 1: generate an external secret key.Step 2: convert imageIbimxn images.Step 3: extract an internal secret key.Step 4: apply zigzag process on binary images.Step 5: select and apply affine transformation on each zigzag binary images using the external key.Step 6: reconstruct a new gray-scale image using transformed zigzag binary images.Step 7: subdivide a new image into many nonoverlapping squared subblock.Step 8: for each subblock and forK round,Step 8.1: convert each pixel into the binary vector.Step 8.2: apply scan zigzag operation to permute the position of the binary element in the binary matrix.Step 8.3: reconstruct a gray-scale subblock.Step 8.4: combine an external key and an internal key to generate the substitution sequence of the subblock.Step 8.5: take out a second part of the substitution process.Step 8.6: combine an external key and an internal key to generate the permutation sequence of the subblock.Step 8.7: take out a diffusion process.The decryption algorithm is the inverse operations of the encryption process.


## 2.1.1. External and Internal Keys

The proposed algorithm uses an external secret key of thirty-two hexadecimal numbers as shown in this example: «ABCDEFGHIJKLMNOPRSTUVWαβγηθλξρτφ». This key is used for both substitution-diffusion processes and the choice of the type of affine transformation to be applied on binary images. An original image Imxn is decomposed into 8 binary images Ibimxn (i = 1, 2, …, 8). Ibimxn are submitted to “XOR” operation and yield one binary matrix. This matrix is then converted into a pixel matrix. The “XOR” operations between lines of the matrix produce the first part of the internal key named “keyi1,” and while the “XOR” operations between columns produce the second part of the internal key named “keyi2.” Table 1 presents the internal keys of two images ‘ANTAMOEBACOLI’ and ‘Lena,’ respectively. One can see the difference between the two internal keys. So, internal keys are different from image to another. “keyi1” and “keyi2” are combined with an external key to generate substitution-diffusion sequences, and consequently, substitution-diffusion sequences are also different for one image to another, and this makes the algorithm high secured and resistant against attacks.Table 1
Internal keys of two images: ANTAMOEBACOLI and ‘Lena.’
78188117104223128201731631498817717520020226129697614081116102113169172481859532213165642172521931821064044510169209255631819217424813024312029157150246462451346217414215834176210111521562785054715522066248451941648970238221204565758432231046724914323425550515253546061207646568707255565758596061627374757677798081Keyi1 of ANTAMOEBACOLI imageKeyi2 of ANTAMOEBACOLI image1389723215316285200238115471601079422461529424523118350172131861201024876237842461542532305311825520259218772551681142017620453117195102643911225133143117023275791567811915469206739524244189514014714110118412791452112210117663211100106221879813124178108103208216313090190168051381448981582242423723912611210180208171142341992212882Keyi1 of lena imageKeyi2 of lena image


## 2.1.2. Zigzag Process

The zigzag process aims to scramble the image by changing the position of the pixel or the bit. Depending on the context, it can act as a diffusion or substitution process. In this algorithm, the zigzag process applied to the whole binary image acts as a diffusion process. In the case of the binary subblock, it acts as a substitution process. A zigzag process to scramble the binary images is shown in Figure2.Figure 2
A zigzag path to scramble the binary subblock.


## 2.1.3. Affine Transformation Process

On the Euclidean plane, letw:R2⟶R2 be an affine transformation; its equation is given by(1)wx,y=ax+by+e,cx+dy+f=x′,y′,where x,y is the coordinate point, a,b,c,d,e, and f are real numbers, and x′,y′ is the new coordinate point. We can also write this same transformation with the equivalent notations:(2)wu=wxy=abcdxy+ef=x′y′=Au+T,where A is a 2×2 real matrix and T=ef represents translations.The matrixA can also be written in the form of(3)A=abcd=r1cosθ1−r2sinθ2r1sinθ1r2cosθ2,where r1,θ1 are the polar coordinates of the point a,c and r2,θ2+π/2 are the polar coordinates of the point (b, d). In other words,(4)r1=a2+c2,tanθ1=ca,r2=b2+d2,tanθ2=bd.Various transformations can be performed inR2 such as dilations, reflections, translations, rotations, and similitudes. In this work, we are restricted to reflection and rotation transformations.A reflection on thex-axis can be written in as wrxx,y=x,−y, while a reflection on the y-axis is written as wryx,y=−x,y. In matrix representation, these reflections are given by(5)x′,y′,wryu=−1001xy.A rotation mapping has the formwrx,y=xcosθ−ysinθ,xsinθ+ycosθ.Also, it is expressed as(6)wru=cosθ−sinθsinθcosθxy.For the rotation angleθ, 0≤θ<2π.The available reflection and rotation transformations are(0)
Identity (I):(1)
Orthogonal reflection around midvertical axis of block (Rmv)(2)
Orthogonal reflection around midhorizontal axis of block (Rmh)(3)
Orthogonal reflection around the first diagonal of block (Rfdiag)(4)
Orthogonal reflection around the second diagonal of block (Rsdiag)(5)
Rotation around the center of block +90° (R + 90)(6)
Rotation around the center of block +180°(R + 180)(7)
Rotation around the center of block −90°(R−90)In the algorithm step, we use zigzag binary matrices namedIbzimxn, i = 1, 2, …, 8. An external key is used to choose the corresponding type of transformation to be applied on each zigzag binary image Ibzimxn. Let «ABCDEFGHIJKLMNOPRSTUVWαβγηθλξρτφ» be an external key; to choose the corresponding affine transformations, we extract eight numbers «D, H, L, P, U,β, λ, φ» from an external key. Each number is converted into its corresponding octave number. The obtained octave number gives the corresponding transformation (from 0 to 7 as describe previously) to be applied on the corresponding zigzag binary image. An external key should be chosen such as all these obtained octave number must not be null. At the end of the affine transformation process, the transformed binary images are used to reconstruct a new gray-scale image Imxn′. This image Imxn′ is subdivided into nonoverlapping squared block before the substitution-diffusion process.


## 2.1.4. Substitution Process

The operation is taken into two steps, zigzag operation and substitution, using the corresponding key. The chosen subblockSIkxk′ is converted into a binary subblock SbI′. The zigzag operation is taken on SbI′, and it is reconverted into the pixel value. A zigzag path to scramble the binary block is shown in Figure 2. The next step is to combine an external key with «keyi1» to generate the sequence which will be used for substitution operation. Let L be the size of a subblock. Having an external key «externalkey» and an internal key «substitutioncode», the algorithm to generate the sequence of each block is defined as follows:(a)
For the first round and the first subblock,Lon = length (keyi1);lng = Lon/2;codesub = keyi1;cc1 = bitxor (externalkey, codesubu (1 : lng));cc2 = bitxor (cc1, codesub ((lng + 1) : Lon));usingcode = [cc1 cc2];(b)
For the next round K and the other subblocks,codesubu = usingcode;c1 = bitxor (clefdecfin, codesubu ((lng + 1) : Lon));cc1 = bitxor (c1, vectsub (1 : 1 : lng));c2 = bitxor (cc1, codesubu (lng:−1 : 1));cc2 = bitxor (c2, vectsub ((lng + 1) : Lon));usingcode = [cc1 cc2];« vectsub » is the last result.The sequence «usigncode» will be used for the substitution process of the corresponding subblock. The second step of the substitution process is performed using «XOR» operation.


## 2.1.5. Diffusion Process

The subblock coming from the substitution process is then sent through the permutation process. This process will modify the pixel location. The same algorithm used during the substitution process is used to generate the sequence for the diffusion process in which « keyi2» is used. The sequence of each subblock is rearranged in the ascending order and used to modify the position of the pixel in the subblock.


## 2.1.6. The Overall Proposed Encryption Algorithm

LetImxn be an original image. We can describe our encryption algorithm as follows:Step 1: generate an external secret key.Step 2: convert imageIbimxn images.Step 3: extract an internal secret key.Step 4: apply zigzag process on binary images.Step 5: select and apply affine transformation on each zigzag binary images using the external key.Step 6: reconstruct a new gray-scale image using transformed zigzag binary images.Step 7: subdivide a new image into many nonoverlapping squared subblock.Step 8: for each subblock and forK round,Step 8.1: convert each pixel into the binary vector.Step 8.2: apply scan zigzag operation to permute the position of the binary element in the binary matrix.Step 8.3: reconstruct a gray-scale subblock.Step 8.4: combine an external key and an internal key to generate the substitution sequence of the subblock.Step 8.5: take out a second part of the substitution process.Step 8.6: combine an external key and an internal key to generate the permutation sequence of the subblock.Step 8.7: take out a diffusion process.The decryption algorithm is the inverse operations of the encryption process.


## 2.2. Evaluation Metrics

A robust and good cryptosystem should present many features. Firstly, the key space should be large enough to make the brute-force attack infeasible [17]. Secondly, the histograms of the cipher image should be uniformly distributed. The correlation between adjacent pixels (vertically, horizontally, and diagonally) in the cipher image should be approximately zero to confirm the effectiveness of the method.


### 2.2.1. Correlation Coefficient

The correlation metric is used to evaluate the similarity between two images. If the images are identical, the correlation value is equal to one. When the correlation value is closed to zero, there is no similarity between these images. For an efficient encryption scheme, the correlation between plain image and cipher image must be close to zero. The correlation coefficient (Co) between original and encrypted images is defined as follows:(7)Co=Np∑j=1Npxj×yj−∑j=1Npxj×∑j=1NpyjNp∑j=1Npxj2−∑j=1Npxj2×Np∑j=1Npyj2−∑j=1Npyj2,where x and y are gray-scale pixel values of the original and encrypted images and Np is the total number of pixels.The correlation coefficientγ of each pair of adjacent pixels is calculated using [42](8)γx,y=covx,yDxDy,where(9)covx,y=1Nap∑i=1Napxi−Exyi−Ey,(10)Ex=1Nap∑i=1Napxi,(11)Dx=1Nap∑i=1Napxi−Ex2.In equations (8)–(11), x and y are the gray values of two adjacent pixels in the image and Nap is the total number of adjacent pairs of pixels. Ex is the expectation of variable x, Dx is the variance, and covx,y is the covariance of two adjacent pixels in the image. For a good cryptosystem, the correlation coefficient Co between plain and cipher images should be close to zero. Likewise, the correlation coefficient γ of each pair of adjacent pixels in the cipher image should be close to zero.


### 2.2.2. Entropy Information

The information entropy, introduced by Shannon, is one of the most important features of randomness. It is used to evaluate the quantity of information in the image. Information entropyHs is calculated in [28] using(12)Hs=∑i=0Ngl−1Psilog21psi,where Ngl is the total number of gray levels in the image and Psi shows the probability of appearance of the symbol si. The entropy value of encrypted images should be closed to eight.The (k, TB)-local Shannon entropy with respect to local image blocks may be computed by the following steps [43]. First, nonoverlapping image blocks S1, S2, … Sk with TB pixels for a test image S are randomly selected. Then, information entropy H (Si) for all image blocks via equation (12) may be obtained. Finally, the local Shannon entropy over these k image blocks is computed using(13)Hk,TBm=∑i=1kHSik.


### 2.2.3. Differential Attacks

The change of a single pixel on a plain image should have an important effect on the cipher image. Number of Pixels Change Rate (NPCR) and Unified Average Changing Intensity (UACI) are used to test the influence of changing a single pixel in the original image on the whole encrypted image [17]. Therefore, if Ai,j and Bi,j are the pixels in row i and column j of the encrypted images A and B, with only one-pixel difference between the respective plain images, then the NPCR is calculated by using the following formula [44]:(14)NPCR=∑i,jDi,jW×H×100%,where W and H are the width and height of A or B. Di,j is calculated as follows:(15)Di,j=1,ifAi,j≠Bi,j,0,otherwise.UACI is calculated by the following formula:(16)UACIA,B=1W×H∑i,jAi,j−Bi,j255×100%.The estimated score for NPCR and UACI are 99.6094% and 33.4635% for gray-scale images [45].


### 2.2.4. Image Quality Criterion

After the encryption/decryption processes, we need to evaluate the performance of the cryptosystem and the quality of images. This is done by evaluating the mean square error (MSE), the peak signal-to-noise ratio, (PSNR) and the encryption quality.LetP and P′, respectively, be a plain image, an encrypted image, and a decrypted image. MSE is defined as follows:(17)MSE=∑m=1M∑n=1NPm,n−P′m,n2M×N,where M is the total number of lines in the image and N is the total number of columns. The PSNR is defined as follows:(18)PSNR=10Log102552MSE.When the decrypted imageP′ is identical to the plain one, MSE is zero, and consequently, PSNR is infinite.The total changes in pixels’ values between the plain image and the encrypted image allow to confirm the encryption quality. So, encryption quality gives us the average number of changes to each gray level between plain image and its corresponding encrypted image. It is defined as follows:(19)Encryption quality⇀=∑L255HLC−HLP256,where C denotes the encrypted image, L is the gray level, L=0,1,2,…255, and HL is the total number of occurrence of L in the image.


## 2.2.1. Correlation Coefficient

The correlation metric is used to evaluate the similarity between two images. If the images are identical, the correlation value is equal to one. When the correlation value is closed to zero, there is no similarity between these images. For an efficient encryption scheme, the correlation between plain image and cipher image must be close to zero. The correlation coefficient (Co) between original and encrypted images is defined as follows:(7)Co=Np∑j=1Npxj×yj−∑j=1Npxj×∑j=1NpyjNp∑j=1Npxj2−∑j=1Npxj2×Np∑j=1Npyj2−∑j=1Npyj2,where x and y are gray-scale pixel values of the original and encrypted images and Np is the total number of pixels.The correlation coefficientγ of each pair of adjacent pixels is calculated using [42](8)γx,y=covx,yDxDy,where(9)covx,y=1Nap∑i=1Napxi−Exyi−Ey,(10)Ex=1Nap∑i=1Napxi,(11)Dx=1Nap∑i=1Napxi−Ex2.In equations (8)–(11), x and y are the gray values of two adjacent pixels in the image and Nap is the total number of adjacent pairs of pixels. Ex is the expectation of variable x, Dx is the variance, and covx,y is the covariance of two adjacent pixels in the image. For a good cryptosystem, the correlation coefficient Co between plain and cipher images should be close to zero. Likewise, the correlation coefficient γ of each pair of adjacent pixels in the cipher image should be close to zero.


## 2.2.2. Entropy Information

The information entropy, introduced by Shannon, is one of the most important features of randomness. It is used to evaluate the quantity of information in the image. Information entropyHs is calculated in [28] using(12)Hs=∑i=0Ngl−1Psilog21psi,where Ngl is the total number of gray levels in the image and Psi shows the probability of appearance of the symbol si. The entropy value of encrypted images should be closed to eight.The (k, TB)-local Shannon entropy with respect to local image blocks may be computed by the following steps [43]. First, nonoverlapping image blocks S1, S2, … Sk with TB pixels for a test image S are randomly selected. Then, information entropy H (Si) for all image blocks via equation (12) may be obtained. Finally, the local Shannon entropy over these k image blocks is computed using(13)Hk,TBm=∑i=1kHSik.


## 2.2.3. Differential Attacks

The change of a single pixel on a plain image should have an important effect on the cipher image. Number of Pixels Change Rate (NPCR) and Unified Average Changing Intensity (UACI) are used to test the influence of changing a single pixel in the original image on the whole encrypted image [17]. Therefore, if Ai,j and Bi,j are the pixels in row i and column j of the encrypted images A and B, with only one-pixel difference between the respective plain images, then the NPCR is calculated by using the following formula [44]:(14)NPCR=∑i,jDi,jW×H×100%,where W and H are the width and height of A or B. Di,j is calculated as follows:(15)Di,j=1,ifAi,j≠Bi,j,0,otherwise.UACI is calculated by the following formula:(16)UACIA,B=1W×H∑i,jAi,j−Bi,j255×100%.The estimated score for NPCR and UACI are 99.6094% and 33.4635% for gray-scale images [45].


## 2.2.4. Image Quality Criterion

After the encryption/decryption processes, we need to evaluate the performance of the cryptosystem and the quality of images. This is done by evaluating the mean square error (MSE), the peak signal-to-noise ratio, (PSNR) and the encryption quality.LetP and P′, respectively, be a plain image, an encrypted image, and a decrypted image. MSE is defined as follows:(17)MSE=∑m=1M∑n=1NPm,n−P′m,n2M×N,where M is the total number of lines in the image and N is the total number of columns. The PSNR is defined as follows:(18)PSNR=10Log102552MSE.When the decrypted imageP′ is identical to the plain one, MSE is zero, and consequently, PSNR is infinite.The total changes in pixels’ values between the plain image and the encrypted image allow to confirm the encryption quality. So, encryption quality gives us the average number of changes to each gray level between plain image and its corresponding encrypted image. It is defined as follows:(19)Encryption quality⇀=∑L255HLC−HLP256,where C denotes the encrypted image, L is the gray level, L=0,1,2,…255, and HL is the total number of occurrence of L in the image.


## 3. Experimental Results

In this work, we used medical and nonmedical images from different databases. Some of the medical images (parasite images) have been taken from different hospital laboratories. The others are from [46, 47]. Nonmedical images are from [48]. Azafack and Guefack images have been taken with a Smartphone techno-Y4. Our algorithm should be carried out using MATLAB R2014a in COMPAQ Intel ® core ™ i3-2328M CPU @ 2.20 GHz 2.20 GHz. The time for encrypting/decrypting an image of 512 × 512 is 1.1 s. The times for encrypting/decrypting of many images are presented in Table 2.Table 2
Encryption/decryption time.
Image sizeEncryption/decryption time (second)512 × 5121.1256 × 2560.553128 × 1280.28964 × 640.104


### 3.1. Visual Test

To appreciate the effect of the zigzag and affine transformation processes, we present in Figure3 some plain images and their corresponding transformed images. Physically, these processes have destroyed the correlations between the adjacent pixels in the plain images. Figure 4 presents some encrypted and decrypted images using our proposed cryptosystem where the external key is “A23C56789ABADEF7167DEAB6789367A9». The size of the subblock is 4 × 4 pixels and the number of rounds on one subblock is five. It is obvious from visual inspection of Figures 4(a)–4(h)) that there is no correlation between the original image and encrypted image. It is therefore impossible, by observing the encrypted image, to deduce the original image. This ensures the physical privacy of the cryptosystem. When observing original and decrypted images in Figures 4(a), 4(c), 4(d), 4(f), 4(g), and 4(i)), it is obvious that the image decrypted is similar to the original image. This test was performed on many other images using different keys, and all the results were conclusive. Thus, visually, the efficiency of the cryptosystem is guaranteed. Thereafter, we conducted a statistical analysis in order to confirm the results of the visual tests.Figure 3
Effect of zigzag and affine transformation processes on some images using the external key «A23C56789ABADEF7167DEAB6789367A9»: (a) “Antamoebacoli” and its corresponding transformed image. (b) A plain image “Balantidum Coli cyst” and its corresponding transformed image. (c) A plain image “Girl (Lena, 4.2.04)” and its corresponding transformed image.
(a)(b)(c)Figure 4
Visual test on some images using the secret key «A23C56789ABADEF7167DEAB6789367A9»: (a), (b), and (c) A plain image “Balantidum Coli cyst” and its corresponding cipher and decrypted image, respectively. (d), (e), and (f) A plain image “echopelv” and its corresponding cipher and decrypted image, respectively. (g), (h), and (i) A plain image “Girl (Lena, 4.2.04)” and its corresponding cipher and decrypted image, respectively. (j), (k), and (l) A plain image “Guefack” and its corresponding cipher and decrypted image, respectively.
(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)(l)


### 3.2. Key space Analysis

The key space of a good image encryption algorithm should be large enough to make any brute-force attack ineffective [17, 42]. The proposed algorithm used two keys. Firstly, an external key of 128 bits is long; thus, the cipher image has 2128 different combinations of the secret key. Secondly, we use an internal secret key of 32 or 64 gray values which are long coming from the decomposition of an original image. So, the size of the key is large enough.


### 3.3. Correlation Tests

#### 3.3.1. Correlation between Plain and Cipher Image

In Table3, the correlation coefficients between plain and cipher images of several medical gray-scale images are given. It is observed that all the correlation coefficients are negligible. The highest value (0, 00348) is obtained for the “ossify” image. The cipher images are not correlated with plain images. The correlation between the decrypted and the original images is always “1” confirming that both images are identical. The algorithm has been applied on other types of nonmedical images. We have used the USC-SIPI image database which is a collection of the digitized image available and maintained by the University of Southern California [42]. Table 4 shows the results of those images. The same as for medical images, correlation coefficients of images in Table 4 are closed to zero. The maximum value (−0, 00504) of the correlation coefficient is very low compared to the critical value (1). This confirms that the proposed algorithm is efficient for every type of image.Table 3
Correlation coefficients and entropy information of some medical images.
Image nameSizeCorrelation coefficients between plain and cipher imagesEntropy value of plain imageEntropy value of cipher imageCorrelation coefficients between plain and decrypted imagesANTAMOEBACOLI398 × 407−1.27e−036.97147.99931article_oeuf_taeniaC2200 × 2003.23e−037.23487.99931Balantidium coli cyst200 × 200−2.54e−037.01187.99931Balantidium coli_trophozoite200 × 200−1.76e−035.67427.99921DICROCOELIUM400 × 3411.66e−036.61757.99941Entamoeba coli trophozoite200 × 200−9.34e−047.12347.99921Entamoeba histolytica cyst200 × 200−1.08e−035.81027.99941Entamoeba histolytica-cyst-Gini130 × 1301.58e−036.50167.99931Entamoeba histolytica trophozoite200 × 2008.49e−047.62177.99941Entamoeba histolytica trophozoite_redim120 × 120−3.26e−037.85227.99921Entamoeba histolytica trophozoite_redim2172 × 1607.73e−057.73677.99931oeuf_ascarisc266 × 200−1.48e−046.91077.99931S- Hematobium egg400 × 300−1.03e−037.19837.99921S- Mansoni egg400 × 3009.58e−046.45617.99931tropho_entamoeba_histolytica2332 × 213−1.99e−033.82347.99931tropho_iodamoeba_butschlii200 × 2007.70e−046.32477.99931Angio64 × 64−3.21e−037.27697.99921DisLocElbow64 × 649.58e−045.53267.99931echo164 × 641.61e−036.32817.99931I1_20064 × 64−7.02e−046.47467.99931Node264 × 64−8.81e−046.87327.99941Ossify64 × 643.48e−036.99897.99931Pelvis64 × 641.29e−036.46537.99931Ribs64 × 641.12e−036.22987.99911Dirofilaria241 × 500−2.59e−036.76667.99931Headirm256 × 2561.38e−035.02997.99931Abdomenirm256 × 256−6.18e−046.95517.99931Pelvisirm256 × 2561.08e−036.73797.99931Gastrointestinal_parasites512 × 3925.58e−077.66347.99941Echo fetus at 12 weeks300 × 2103.41e−046.40627.99931Ultrasound of fetus of 3months512 × 3961.90e−037.29997.99941Echopelv601 × 711−6.74e−046.58967.99981CT-MONO2-8-abdo128 × 128−4.3347e−045.89257.99921OT-MONO2-8-colon128 × 128−2.7e−036.74687.99931Table 4
Correlation coefficients and entropy information of some nonmedical images.
File nameDescriptionSizeCorrelation coefficients between plain and cipher imagesEntropy value of plain imageEntropy value of cipher imageCorrelation coefficients between plain and decrypted images4.1.01Girl256 × 2563.46e−037.18357.999414.1.02Couple256 × 2561.05e−036.50077.999314.1.03Girl256 × 2566.15e−045.95497.999414.1.04Girl256 × 256−2.82e−047.60317.999314.1.05House256 × 2561.95e−037.09027.999314.1.06Tree256 × 256−3.07e−037.56347.999314.1.07Jelly beans256 × 256−1.85e−036.60987.999314.1.08Jelly beans256 × 2561.44e−036.88637.999314.2.01Splash512 × 5129.15e−047.32327.999414.2.02Girl (tiffany)512 × 512−2.28e−036.66917.999314.2.03Mandrill (a.k.a. Baboon)512 × 512−5.77e−047.76597.999314.2.04Girl (lena. or lena)512 × 5124.40e−047.75487.999314.2.05Airplane (F-16)512 × 5121.89e−046.68797.999414.2.06Sailboat on lake512 × 5125.04e−037.76757.999414.2.07Peppers512 × 5122.20e−037.72537.999315.1.09Moon surface256 × 256−1.16e−036.7197.999315.1.10Aerial256 × 2561.71e−037.3227.999215.1.11Airplane256 × 256−3.61e−036.46587.999415.1.12Clock256 × 2561.95e−036.71117.999315.1.13Resolution chart256 × 256−1.47e−032.28637.999415.1.14Chemical plant256 × 2568.36e−057.34737.999315.2.08Couple512 × 512−5.45e−047.21877.999415.2.09Aerial512 × 5121.37e−037.00157.999415.2.10Stream and bridge512 × 512−1.92e−037.7217.999217.1.01Truck512 × 5128.68e−046.58367.999317.1.02Airplane512 × 512−3.11e−055.44087.999317.1.03Tank512 × 512−1.54e−036.40787.999417.1.04Car and APCs512 × 512−1.91e−046.80647.999217.1.05Truck and APCs512 × 512−1.27e−037.11247.999417.1.06Truck and APCs512 × 5122.49e−037.05717.999217.1.07Tank512 × 5122.88e−046.53997.999317.1.08APC512 × 512−2.56e−035.90227.999317.1.09Tank512 × 5121.01e−036.98687.999317.1.10Car and APCs512 × 512−1.11e−036.62017.99941boat.512Fishing boat512 × 5129.47e−047.21517.99921elaine.512Girl (elaine)512 × 5125.99e−047.51187.99921HouseHouse512 × 5121.67e−036.58027.99931gray21.51221 level step wedge512 × 5121.54e−034.59227.99921numbers.512256 level test pattern512 × 512−1.56e−037.77687.99941Azafack398 × 512−1.19e−037.70187.99941Guefack365 × 4868.64e−046.69967.99941


#### 3.3.2. Correlation of Adjacent Pixels

Table5 shows the correlation coefficients between two vertically, two horizontally, and two diagonally adjacent pixels in several medical plain images and also in their corresponding encrypted images. A high correlation is noted between vertically, horizontally, and diagonally adjacent pixels of original images. The lower value (0.67636) is obtained between diagonal adjacent pixels on the image «ANTAMOEBACOLI». For encrypted images, these values are approximately zero showing that two vertically, two horizontally, and two diagonally adjacent pixels of encrypted images are not correlated. The highest value (−0, 00514) is obtained in the case of medical images «article_oeuf_taeniaC2». This is a significant feature proving the effectiveness of our cryptosystem. The same observation is made in the case of nonmedical images in Table 6. The proposed cryptosystem produces encrypted images completely different from original images. In Figure 5, we have presented the distribution of horizontally and vertically adjacent pixels in the plain image and its corresponding encrypted image.Table 5
Correlation coefficients between two vertically, horizontally, and diagonally adjacent pixels in several medical plain images and also in their corresponding encrypted images.
Image nameCorrelation coefficients of original imagesCorrelation coefficients of cipher imagesVert. corHor. corDiag. corVert. corHor. corDiag. corANTAMOEBACOLI0.771410.815320.67636−2.96e−031.31e−031.06e−05Article_oeuf_taeniaC20.931070.93080.87861−1.94e−03−5.14e−037.55e−04Balantidium coli cyst0.769530.786130.662311.74e−03−6.15e−046.42e−04Balantidium coli_trophozoite0.92590.932590.905672.19e−03−3.48e−031.56e−04DICROCOELIUM0.977290.980480.967513.89e−043.14e−03−5.42e−04Entamoeba coli trophozoite0.991290.992150.98588−1.85e−03−9.26e−043.17e−03Entamoeba histolytica cyst0.937250.945370.901852.47e−03−2.75e−03−2.22e−03Entamoeba histolytica-cyst-Gini0.926370.915250.856011.69e−03−2.96e−03−2.11e−04Entamoeba histolytica trophozoite0.984710.985410.974132.36e−032.87e−039.35e−04Entamoeba histolytica trophozoite_redim0.982530.983070.96996−1.73e−03−2.91e−03−3.19e−04Entamoeba histolytica trophozoite_redim20.986220.98670.975452.20e−031.51e−04−8.70e−05oeuf_ascarisc0.931550.934450.880982.59e−04−1.48e−03−6.88e−04S-Hematobium egg0.885540.923830.8354−1.64e−03−2.70e−03−1.60e−03S-Mansoni egg0.869170.90530.80198−3.42e−034.26e−041.10e−03Tropho_entamoeba_histolytica20.992650.991390.986053.29e−035.36e−051.42e−03Tropho_iodamoeba_butschlii0.99660.996880.99391−4.73e−045.99e−04−1.66e−03Angio0.899050.967950.90462−1.78e−033.27e−03−8.62e−04DisLocElbow0.964460.996660.96081.40e−035.22e−041.54e−03Echo10.889040.87760.82121.77e−03−2.03e−043.88e−04I1_2000.993930.987750.983537.66e−048.84e−041.20e−03Node20.964910.954010.933983.21e−032.26e−03−9.21e−04Ossify0.990170.944110.93032.44e−032.14e−039.73e−04Pelvis0.942990.997540.93903−1.73e−031.78e−03−3.68e−03Ribs0.873220.885880.85227−2.05e−04−8.69e−041.70e−04Dirofilaria0.988140.973630.96349−9.60e−04−8.31e−04−4.47e−04Headirm0.963430.957340.93986−2.08e−036.53e−041.32e−03Abdomenirm0.919290.913310.8508−1.35e−03−6.20e−053.75e−04Pelvisirm0.966020.955670.93225−9.36e−044.49e−042.93e−04Gastrointestinal_parasites0.914040.946140.88418−3.06e−04−2.40e−035.55e−05Echo fetus at 12 weeks0.919430.905560.851167.24e−04−3.15e−03−1.24e−03Ultrasound of fetus of 3 months0.967810.986010.95989−1.85e−03−1.60e−032.34e−03Echopelv0.894280.906120.82813−9.96e−04−1.11e−033.76e−04CT-MONO2-8-abdo0.939170.959150.91275−2.57e−03−3.56e−03−2.56e−04OT-MONO2-8-colon0.961890.965560.93819−2.33e−035.95e−04−4.25e−04Table 6
Correlation coefficients between two vertically, horizontally, and diagonally adjacent pixels in several nonmedical plain images and also in their corresponding encrypted images from database.
Image NameDescriptionCorrelation coefficients of original imagesCorrelation coefficients of cipher imagesVert corHor corDiag corVert corHor corDiag cor4.1.01Girl0.965470.97370.94928-2.94e−041.58e−035.41e−044.1.02Couple0.956150.938890.906582.09e−03-1.85e−049.21e−044.1.03Girl0.914320.975980.89425-4.05e−042.47e−034.50e−044.1.04Girl0.984760.969950.958055.88e−055.11e−04-1.98e−034.1.05House0.952890.97810.94157-3.75e−04-1.20e−032.38e−044.1.06Tree0.94410.966950.9285-2.87e−03-3.22e−035.65e−044.1.07Jelly beans0.982330.97870.964611.58e−03-4.40e−03-2.56e−034.1.08Jelly beans0.975530.972580.952463.56e−03-7.71e−04-6.16e−044.2.01Splash0.99150.983990.980542.25e−04-1.19e−03-8.85e−044.2.02Girl (tiffany)0.940970.938260.91514-2.56e−03-8.88e−041.63e−034.2.03Mandrill (a.k.a. Baboon)0.754860.862690.723241.36e−03-5.84e−04-4.73e−044.2.04Girl (lena. or lena)0.984850.971590.96359.09e−05-2.57e−04-4.52e−044.2.05Airplane (F-16)0.963940.966160.94106-7.67e−042.28e−03-9.57e−054.2.06Sailboat on lake0.970030.973680.957689.21e−045.35e−043.48e−044.2.07Peppers0.977880.975670.968063.40e−03-1.47e−03-3.18e−045.1.09Moon surface0.930930.894440.883853.49e−032.34e−03-1.91e−035.1.10Aerial0.857310.902340.807793.27e−04-1.65e−031.42e−035.1.11Airplane0.937220.956970.913916.44e−04-1.97e−03-1.84e−035.1.12Clock0.973730.956130.93755-1.33e−03-1.34e−031.06e−035.1.13Resolution chart0.866780.872420.757131.78e−038.89e−04-2.11e−045.1.14Chemical plant0.896470.945250.86728.69e−04-3.28e−03-2.29e−035.2.08Couple0.892440.936840.855281.14e−049.13e−041.12e−035.2.09Aerial0.858030.898630.80248-1.94e−03-2.45e−04-6.92e−045.2.10Stream and bridge0.925480.938540.897871.79e−031.26e−038.91e−047.1.01Truck0.917380.959270.90241-1.88e−034.08e−03-1.90e−047.1.02Airplane0.946370.94670.91936-1.35e−032.23e−031.04e−037.1.03Tank0.926650.940730.90446-2.69e−03-3.46e−03-2.49e−037.1.04Car and APCs0.966140.975380.95392-1.17e−036.70e−041.46e−037.1.05Truck and APCs0.906610.936850.88725-4.51e−031.12e−03-8.10e−047.1.06Truck and APCs0.900450.934650.88065-3.92e−036.38e−043.34e−047.1.07Tank0.868130.87680.82074-3.03e−03-2.04e−04-1.32e−037.1.08APC0.924230.953330.91346-1.88e−033.75e−032.08e−047.1.09Tank0.926750.962390.91523-3.11e−031.84e−03-2.76e−037.1.10Car and APCs0.945040.961810.92815-2.16e−04-3.24e−037.66e−04Boat.512Fishing boat0.969930.936380.923085.46e−04-3.22e−031.83e−04Elaine.512Girl (elaine)0.96970.972560.96796-1.19e−035.92e−04-1.12e−03HouseHouse0.950590.973050.938464.29e−03-8.68e−04-2.47e−03Gray21.51221-level step wedge0.999840.996530.996361.55e−03-1.49e−038.19e−04Numbers.512256-level test pattern0.716030.738890.641861.32e−03-3.03e−051.43e−03Azafack0.958720.940020.924291.94e−043.10e−03-5.24e−04Guefack0.990570.990220.984721.60e−035.02e−046.64e−04Figure 5
Correlation of adjacent pixels in «article_oeuf_taeniaC2.jpg image. (a) and (c) The distribution of horizontal and vertical adjacent pixels in the plain image. (b) and (d) The distribution of horizontal and vertical adjacent pixels in the corresponding encrypted image.
(a)(b)(c)(d)


### 3.4. Histograms

The histograms of both the plain and the encrypted images using our proposed method are shown in Figure6. The histograms of the encrypted images are uniformly distributed while those of plain images are not. This confirms the toughness of the method over any statistical attack. The security of the encryption method is therefore very strong.Figure 6
Histogram analysis plain and cipher images using the secret key «A23C56789ABADEF7167DEAB6789367A9»: (a), (b), (c), and (d) A plain image “Balantidium Coli cyst” and its corresponding histogram, cipher image, and cipher image histogram, respectively. (e), (f), (g), and (h) A plain image “echopelv» and its corresponding histogram, cipher image, and cipher image histogram, respectively. (i), (j), (k), and (l) A plain image “Girl (Lena, 4.2.04)» and its corresponding histogram, cipher image, and cipher image histogram, respectively. (m), (n), (o), and (p) A plain image “Guefack» and its corresponding histogram, cipher image, and cipher image histogram, respectively.
(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)(l)(m)(n)(o)(p)


### 3.5. Key Sensitivity Test

An ideal cipher image should be extremely sensitive with respect to the key used in the algorithm during the encryption and decryption processes.


#### 3.5.1. Key Sensitivity Test of Encryption Process

An insignificant change in the encryption key should be sensitive to the cipher images. We take out the key sensitivity test during the encryption process by using different keys to encrypt the same image. The difference between keys is a single bit change. The procedure is described as follows:(a)
We used «A23C56789ABADEF7167DEAB6789367A9» as first external key to encrypt«S-Hematobium egg» image. The encrypted image is presented on Figure7(b).(b)
We change a single bit on the external key by substituting the fourth character “C” into “D.” The external key in this case becomes «A23D56789ABADEF7167DEAB6789367A9». The obtained encrypted image is presented on Figure7(c).(c)
In the second case, we change the sixteenth character 7 in the external key into 6. The used external key is then«A23C56789ABADEF6167DEAB6789367A9». The encrypted image is shown in Figure 7(d).(d)
In the test number 3, the used external key is changed into«A23C56789ABADEF7167DEAB6789367AA». Here, the last character 9 in the first external key is changed into A. Figure 7(e) presents a cipher image obtained.(e)
For the last test, the second character 2 in the external key is changed into 3. The used external key becomes «A33C56789ABADEF7167DEAB6789367A9». Figure7(f) presents a cipher image obtained.Figure 7
Plain and cipher images. (a) The plain image of «S-Hematobium egg». (b) to (f) The different cipher images obtained with different external keys.
(a)(b)(c)(d)(e)(f)For a quantitative assessment of the similarity between those images, we present in Table7 the correlation coefficients between the different cipher images.Table 7
Correlation coefficients between various cipher images presented in Figure7
ImagesCorrelation coefficientsFigures6(a) and 6(b)−0.0010Figures6(a) and 6(c)−6.6046e−04Figures6(a) and 6(d)−2.6622e−04Figures6(a) and 6(e)1.4038e−04Figures6(a) and 6(f)0.0014Figures6(b) and 6(c)5.5615e−04Figures6(b) and 6(d)0.0031Figures6(b) and 6(e)0.0027Figures6(b) and 6(f)−0.0016Figures6(c) and 6(d)0.0041Figures6(c) and 6(e)−0.0022Figures6(c) and 6(f)8.2013e−04Figures6(d) and 6(e)−5.3809e−04Figures6(d) and 6(f)8.4005e−04Figures6(e) and 6(f)−6.3580e−04Although the difference from one key to the other is a single bit, we note from Table7 that the values of the correlations’ coefficients between the different encrypted images obtained are closed to zero. The highest correlation value obtained is 0.0041. This test was performed on several other images and all the results are conclusive. This implies that the encrypted images produced from the proposed cryptosystem are different. This means that the proposed cryptosystem is very sensitive to the encryption key.


#### 3.5.2. Key Sensitivity Test of Decryption Process

In a robust encryption scheme, an insignificant change in the key should not let to the decryption of the cipher image successfully [17]. The key sensitivity test was performed using a slightly different external key to decrypt the encrypted images. Some examples are given below. A “ultrasound of fetus of 3 months” image (Figure 8(a)) has been encrypted using the proposed cryptosystem where the external key is “A23C56789ABADEF7167DEAB6789367A9». The encrypted image is shown in Figure 8(b).(a)
Firstly, the encrypted image (Figure8(b)) is decrypted with a decrypted external key «A23D56789ABADEF7167DEAB6789367A9» which is different to the encryption external key «A23C56789ABADEF7167DEAB6789367A9» by a single bit. The fourth character C in the encryption external key is changed into D in the decryption external key. The decrypted image is shown in Figure 8(c).(b)
In the second test, the encrypted image (Figure8(b)) is decrypted by using «A23C56789ABADEF6167DEAB6789367A9» as the external key. The sixteenth character 7 in the encryption external key is changed into 6 in the decryption external key. The decrypted image is shown in Figure 8(d).(c)
In this case, the encrypted image (Figure8(b)) is decrypted using the decrypted external key «A23C56789ABADEF7167DEAB6789367AA». The last character 9 in the encryption external key is changed into A in the decryption external key. Figure 8(e) shows the decrypted image which is not correlated with the original image.(d)
In Figure8, Figure 8(b) has been decrypted using «A33C56789ABADEF7167DEAB6789367A9» as the decrypted external key. The second character 2 in the encryption external key is changed into 3 in the decryption external key.Figure 8
(a and b) The plain image from “ultrasound of fetus of 3 months” image and its corresponding encrypted image. (c)-(f) The decrypted images from the encrypted image of Figure8(b) using slightly different decryption keys than the key used for encryption.
(a)(b)(c)(d)(e)(f)Physically, the decrypted images are not similar to a plain image “ultrasound of fetus of 3 months,” as we can see in Figure 8. The correlation coefficients between the plain image and the decrypted images using a slightly different key have been calculated. They are all closed to zero as we can see in Table 8. Any change on an external secret key affects the angle of the eight used rotations and changes an internal key. Consequently, the resulting substitution-diffusion key is modified. It comes out that, without an exact key, one cannot succeed in the decryption process. This confirms the effectiveness and key sensitivity of the proposed algorithm.Table 8
Correlation coefficients between various decrypted images shown in Figure8.
ImagesCorrelation coefficientsFigures7(a) and 7(b)0.0019Figures7(a) and 7(c)−5.0690e−04Figures7(a) and 7(d)9.6489e−04Figures7(a) and 7(e)−5.8923e−04Figures7(a) and 7(f)1.4796e−04Figures7(b) and 7(c)−0.0014Figures7(b) and 7(d)−0.0014Figures7(b) and 7(e)8.0764e−04Figures7(b) and 7(f)−0.0018Figures7(c) and 7(d)−0.0016Figures7(c) and 7(e)−1.0391e−04Figures7(c) and 7(f)0.0030Figures7(d) and 7(e)0.0038Figures7(d) and 7(f)0.0024Figures7(e) and 7(f)8.9324e−04So, the proposed cryptosystem is very sensitive to the encryption and decryption of external keys.


### 3.6. Attack Analyses

#### 3.6.1. Entropy Information Analysis

It comes out from Tables3 and 4 that the values of entropy information obtained with our new proposed scheme on medical and nonmedical images are very close to 8. The highest value is 7.9998 and the lowest one is 7.9991 for medical images, while the lowest value is 7.9992 and the highest value is 7.9994 for nonmedical images. These values are very close to eight (ideal value) compared to the entropy of the original images. This indicates that the proposed algorithm has hidden information randomly, and information leakage in the encryption process is negligible. We evaluated the local entropy of many images using TB = 1936 as in [43], and the results are presented in Table 9. We conclude the effectiveness of the algorithm considering the high values of entropy information and the local entropy.Table 9
Local entropies for the cipher images.
ImagesBalantidium coli cyst (200 × 200)Echopelv (601 × 711)Girl (lena, 4.2.04) (512 × 512)Guefack (365 × 486)Local entropy information7.90887.90817.90917.9085


#### 3.6.2. Differential Attacks

Tables10 and 11 present the values of the Number of Pixels Change Rate (NPCR) and Unified Average Changing Intensity (UACI) for medical and nonmedical images.Table 10
Values of the number of pixels change rate (NPCR) and unified average changing intensity (UACI) in several medical images.
Image nameCorr (A.B)NCPRUACIMSEPSNRANTAMOEBACOLI−1.72e−0399.616633.46130∞article_oeuf_taeniaC21.26e−0399.622733.44760∞Balantidium coli cyst−1.43e−0399.608233.46470∞Balantidium coli_trophozoite3.73e−0499.604433.44870∞DICROCOELIUM−5.02e−0499.60433.45730∞Entamoeba coli trophozoite7.61e−0499.620133.46610∞Entamoeba histolytica cyst−1.82e−0399.610533.53860∞Entamoeba histolytica-cyst-Gini−2.94e−0399.615933.54020∞Entamoeba histolytica trophozoite6.55e−0499.612433.45650∞Entamoeba histolytica trophozoite_redim8.47e−0499.606733.45920∞Entamoeba histolytica trophozoite_redim22.35e−0499.598733.46620∞Oeuf_ascarisc7.00e−0499.613233.48180∞S-Hematobium egg−1.13e−0399.612433.440∞S- Mansoni egg−1.20e−0399.60433.52290∞Tropho_entamoeba_histolytica21.82e−0399.613233.43280∞Tropho_iodamoeba_butschlii1.46e−0499.592633.4720∞Angio5.33e−0499.598333.43290∞DisLocElbow−1.62e−0399.623533.45760∞Echo17.11e−0499.616633.48190∞I1_200−3.09e−0399.605933.55450∞Node29.36e−0499.607533.46140∞Ossify−7.55e−0499.622733.51450∞Pelvis−3.33e−0399.622733.47520∞Ribs3.25e−0399.613633.40690∞Dirofilaria2.97e−0499.615133.47110∞Headirm1.65e−0499.599133.45990∞Abdomenirm−2.53e−0499.621233.4780∞Pelvisirm3.67e−0399.586933.37660∞Gastrointestinal_parasites−1.53e−0399.623533.44980∞Echo fetus at 12 weeks3.31e−0399.618933.43430∞Ultrasound of fetus of 3 months−2.24e−0399.597933.51960∞Echopelv1.79e−0599.600733.46570∞CT-MONO2-8-abdo−4.7542e−0499.61733.46360∞OT-MONO2-8-colon−1.6e−0399.612433.4980∞Table 11
Values of the number of pixels’ change rate (NPCR) and unified average changing intensity (UACI) in several nonmedical images.
File nameDescriptionSizeCorr (A.B)NCPRUACIMSEPSNR4.1.01Girl256 × 256−1.35e−0399.599533.4520∞4.1.02Couple256 × 256−9.35e−0499.611733.49130∞4.1.03Girl256 × 256−1.38e−0399.617833.50030∞4.1.04Girl256 × 2565.57e−0499.613633.47340∞4.1.05House256 × 256−6.70e−0599.601733.4810∞4.1.06Tree256 × 256−3.04e−0399.616633.53540∞4.1.07Jelly beans256 × 2563.16e−0399.61433.43570∞4.1.08Jelly beans256 × 2562.05e−0399.60433.42720∞4.2.01Splash512 × 5129.57e−0499.61233.43380∞4.2.02Girl (tiffany)512 × 5122.78e−0399.610533.39750∞4.2.03Mandrill (a.k.a. Baboon)512 × 5121.94e−0499.606333.43530∞4.2.04Girl (lena. or lena)512 × 5125.32e−-0499.625433.46040∞4.2.05Airplane (F-16)512 × 5121.45e−0399.60433.44260∞4.2.06Sailboat on lake512 × 5121.39e−0499.60933.45130∞4.2.07Peppers512 × 512−1.55e−0399.610533.51160∞5.1.09Moon surface256 × 2562.42e−0399.616633.4340∞5.1.10Aerial256 × 2562.44e−0399.626233.42090∞5.1.11Airplane256 × 2566.09e−0499.608233.48210∞5.1.12Clock256 × 2561.58e−0399.591833.41260∞5.1.13Resolution chart256 × 256−2.49e−0399.610133.53350∞5.1.14Chemical plant256 × 2563.96e−0399.634633.3430∞5.2.08Couple512 × 5128.94e−0499.595633.41830∞5.2.09Aerial512 × 5124.95b0399.611333.35980∞5.2.10Stream and bridge512 × 512−7.71e−0499.611733.51070∞7.1.01Truck512 × 5126.92e−0499.602533.43770∞7.1.02Airplane512 × 5122.96e−0399.604433.40760∞7.1.03Tank512 × 512−6.64e−0499.615933.46960∞7.1.04Car and APCs512 × 5122.12e−0399.610533.43040∞7.1.05Truck and APCs512 × 5127.08e−0499.625433.40410∞7.1.06Truck and APCs512 × 512−4.98e−0499.594133.50410∞7.1.07Tank512 × 5127.41e−0499.617833.44290∞7.1.08APC512 × 512−1.30e−0599.59633.45920∞7.1.09Tank512 × 512−6.91e−0499.618533.49670∞7.1.10Car and APCs512 × 5122.65e−0399.593733.39730∞Boat.512Fishing boat512 × 5121.10e−0399.63333.41210∞Elaine.512Girl (elaine)512 × 512−3.55e−0399.61233.4750∞HouseHouse512 × 5122.72e−0499.617433.44480∞Gray21.51221-level step wedge512 × 512−4.65e−0499.615933.4460∞Numbers.512256-level test pattern512 × 5121.07e−0399.624333.44080∞Azafack398 × 5121.97e−0499.610933.44390∞Guefack365 × 4862.72e−0399.593433.35930∞In all the cases tested, the NPCR values are closed to 99.6% and the UACI is found close to 33.33%. Our new algorithm is very sensitive with respect to a small percentage of pixels’ change in the plain image and the rate of influence because one-pixel change in the plain image is very high. According to Tables10 and 11, the correlation coefficients between the cipher images are negligible. So, a minor pixel change in the plain image has an important effect on the cipher image. The proposed encryption scheme is sensitive to a minor change in the plain image.We have evaluated MSE and PSNR on all test images; the MSE is zero in all the cases and the PSNR is infinite, as we can see in Tables10 and 11. The original and the decrypted image are identical in all cases.


## 3.1. Visual Test

To appreciate the effect of the zigzag and affine transformation processes, we present in Figure3 some plain images and their corresponding transformed images. Physically, these processes have destroyed the correlations between the adjacent pixels in the plain images. Figure 4 presents some encrypted and decrypted images using our proposed cryptosystem where the external key is “A23C56789ABADEF7167DEAB6789367A9». The size of the subblock is 4 × 4 pixels and the number of rounds on one subblock is five. It is obvious from visual inspection of Figures 4(a)–4(h)) that there is no correlation between the original image and encrypted image. It is therefore impossible, by observing the encrypted image, to deduce the original image. This ensures the physical privacy of the cryptosystem. When observing original and decrypted images in Figures 4(a), 4(c), 4(d), 4(f), 4(g), and 4(i)), it is obvious that the image decrypted is similar to the original image. This test was performed on many other images using different keys, and all the results were conclusive. Thus, visually, the efficiency of the cryptosystem is guaranteed. Thereafter, we conducted a statistical analysis in order to confirm the results of the visual tests.Figure 3
Effect of zigzag and affine transformation processes on some images using the external key «A23C56789ABADEF7167DEAB6789367A9»: (a) “Antamoebacoli” and its corresponding transformed image. (b) A plain image “Balantidum Coli cyst” and its corresponding transformed image. (c) A plain image “Girl (Lena, 4.2.04)” and its corresponding transformed image.
(a)(b)(c)Figure 4
Visual test on some images using the secret key «A23C56789ABADEF7167DEAB6789367A9»: (a), (b), and (c) A plain image “Balantidum Coli cyst” and its corresponding cipher and decrypted image, respectively. (d), (e), and (f) A plain image “echopelv” and its corresponding cipher and decrypted image, respectively. (g), (h), and (i) A plain image “Girl (Lena, 4.2.04)” and its corresponding cipher and decrypted image, respectively. (j), (k), and (l) A plain image “Guefack” and its corresponding cipher and decrypted image, respectively.
(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)(l)


## 3.2. Key space Analysis

The key space of a good image encryption algorithm should be large enough to make any brute-force attack ineffective [17, 42]. The proposed algorithm used two keys. Firstly, an external key of 128 bits is long; thus, the cipher image has 2128 different combinations of the secret key. Secondly, we use an internal secret key of 32 or 64 gray values which are long coming from the decomposition of an original image. So, the size of the key is large enough.


## 3.3. Correlation Tests

### 3.3.1. Correlation between Plain and Cipher Image

In Table3, the correlation coefficients between plain and cipher images of several medical gray-scale images are given. It is observed that all the correlation coefficients are negligible. The highest value (0, 00348) is obtained for the “ossify” image. The cipher images are not correlated with plain images. The correlation between the decrypted and the original images is always “1” confirming that both images are identical. The algorithm has been applied on other types of nonmedical images. We have used the USC-SIPI image database which is a collection of the digitized image available and maintained by the University of Southern California [42]. Table 4 shows the results of those images. The same as for medical images, correlation coefficients of images in Table 4 are closed to zero. The maximum value (−0, 00504) of the correlation coefficient is very low compared to the critical value (1). This confirms that the proposed algorithm is efficient for every type of image.Table 3
Correlation coefficients and entropy information of some medical images.
Image nameSizeCorrelation coefficients between plain and cipher imagesEntropy value of plain imageEntropy value of cipher imageCorrelation coefficients between plain and decrypted imagesANTAMOEBACOLI398 × 407−1.27e−036.97147.99931article_oeuf_taeniaC2200 × 2003.23e−037.23487.99931Balantidium coli cyst200 × 200−2.54e−037.01187.99931Balantidium coli_trophozoite200 × 200−1.76e−035.67427.99921DICROCOELIUM400 × 3411.66e−036.61757.99941Entamoeba coli trophozoite200 × 200−9.34e−047.12347.99921Entamoeba histolytica cyst200 × 200−1.08e−035.81027.99941Entamoeba histolytica-cyst-Gini130 × 1301.58e−036.50167.99931Entamoeba histolytica trophozoite200 × 2008.49e−047.62177.99941Entamoeba histolytica trophozoite_redim120 × 120−3.26e−037.85227.99921Entamoeba histolytica trophozoite_redim2172 × 1607.73e−057.73677.99931oeuf_ascarisc266 × 200−1.48e−046.91077.99931S- Hematobium egg400 × 300−1.03e−037.19837.99921S- Mansoni egg400 × 3009.58e−046.45617.99931tropho_entamoeba_histolytica2332 × 213−1.99e−033.82347.99931tropho_iodamoeba_butschlii200 × 2007.70e−046.32477.99931Angio64 × 64−3.21e−037.27697.99921DisLocElbow64 × 649.58e−045.53267.99931echo164 × 641.61e−036.32817.99931I1_20064 × 64−7.02e−046.47467.99931Node264 × 64−8.81e−046.87327.99941Ossify64 × 643.48e−036.99897.99931Pelvis64 × 641.29e−036.46537.99931Ribs64 × 641.12e−036.22987.99911Dirofilaria241 × 500−2.59e−036.76667.99931Headirm256 × 2561.38e−035.02997.99931Abdomenirm256 × 256−6.18e−046.95517.99931Pelvisirm256 × 2561.08e−036.73797.99931Gastrointestinal_parasites512 × 3925.58e−077.66347.99941Echo fetus at 12 weeks300 × 2103.41e−046.40627.99931Ultrasound of fetus of 3months512 × 3961.90e−037.29997.99941Echopelv601 × 711−6.74e−046.58967.99981CT-MONO2-8-abdo128 × 128−4.3347e−045.89257.99921OT-MONO2-8-colon128 × 128−2.7e−036.74687.99931Table 4
Correlation coefficients and entropy information of some nonmedical images.
File nameDescriptionSizeCorrelation coefficients between plain and cipher imagesEntropy value of plain imageEntropy value of cipher imageCorrelation coefficients between plain and decrypted images4.1.01Girl256 × 2563.46e−037.18357.999414.1.02Couple256 × 2561.05e−036.50077.999314.1.03Girl256 × 2566.15e−045.95497.999414.1.04Girl256 × 256−2.82e−047.60317.999314.1.05House256 × 2561.95e−037.09027.999314.1.06Tree256 × 256−3.07e−037.56347.999314.1.07Jelly beans256 × 256−1.85e−036.60987.999314.1.08Jelly beans256 × 2561.44e−036.88637.999314.2.01Splash512 × 5129.15e−047.32327.999414.2.02Girl (tiffany)512 × 512−2.28e−036.66917.999314.2.03Mandrill (a.k.a. Baboon)512 × 512−5.77e−047.76597.999314.2.04Girl (lena. or lena)512 × 5124.40e−047.75487.999314.2.05Airplane (F-16)512 × 5121.89e−046.68797.999414.2.06Sailboat on lake512 × 5125.04e−037.76757.999414.2.07Peppers512 × 5122.20e−037.72537.999315.1.09Moon surface256 × 256−1.16e−036.7197.999315.1.10Aerial256 × 2561.71e−037.3227.999215.1.11Airplane256 × 256−3.61e−036.46587.999415.1.12Clock256 × 2561.95e−036.71117.999315.1.13Resolution chart256 × 256−1.47e−032.28637.999415.1.14Chemical plant256 × 2568.36e−057.34737.999315.2.08Couple512 × 512−5.45e−047.21877.999415.2.09Aerial512 × 5121.37e−037.00157.999415.2.10Stream and bridge512 × 512−1.92e−037.7217.999217.1.01Truck512 × 5128.68e−046.58367.999317.1.02Airplane512 × 512−3.11e−055.44087.999317.1.03Tank512 × 512−1.54e−036.40787.999417.1.04Car and APCs512 × 512−1.91e−046.80647.999217.1.05Truck and APCs512 × 512−1.27e−037.11247.999417.1.06Truck and APCs512 × 5122.49e−037.05717.999217.1.07Tank512 × 5122.88e−046.53997.999317.1.08APC512 × 512−2.56e−035.90227.999317.1.09Tank512 × 5121.01e−036.98687.999317.1.10Car and APCs512 × 512−1.11e−036.62017.99941boat.512Fishing boat512 × 5129.47e−047.21517.99921elaine.512Girl (elaine)512 × 5125.99e−047.51187.99921HouseHouse512 × 5121.67e−036.58027.99931gray21.51221 level step wedge512 × 5121.54e−034.59227.99921numbers.512256 level test pattern512 × 512−1.56e−037.77687.99941Azafack398 × 512−1.19e−037.70187.99941Guefack365 × 4868.64e−046.69967.99941


### 3.3.2. Correlation of Adjacent Pixels

Table5 shows the correlation coefficients between two vertically, two horizontally, and two diagonally adjacent pixels in several medical plain images and also in their corresponding encrypted images. A high correlation is noted between vertically, horizontally, and diagonally adjacent pixels of original images. The lower value (0.67636) is obtained between diagonal adjacent pixels on the image «ANTAMOEBACOLI». For encrypted images, these values are approximately zero showing that two vertically, two horizontally, and two diagonally adjacent pixels of encrypted images are not correlated. The highest value (−0, 00514) is obtained in the case of medical images «article_oeuf_taeniaC2». This is a significant feature proving the effectiveness of our cryptosystem. The same observation is made in the case of nonmedical images in Table 6. The proposed cryptosystem produces encrypted images completely different from original images. In Figure 5, we have presented the distribution of horizontally and vertically adjacent pixels in the plain image and its corresponding encrypted image.Table 5
Correlation coefficients between two vertically, horizontally, and diagonally adjacent pixels in several medical plain images and also in their corresponding encrypted images.
Image nameCorrelation coefficients of original imagesCorrelation coefficients of cipher imagesVert. corHor. corDiag. corVert. corHor. corDiag. corANTAMOEBACOLI0.771410.815320.67636−2.96e−031.31e−031.06e−05Article_oeuf_taeniaC20.931070.93080.87861−1.94e−03−5.14e−037.55e−04Balantidium coli cyst0.769530.786130.662311.74e−03−6.15e−046.42e−04Balantidium coli_trophozoite0.92590.932590.905672.19e−03−3.48e−031.56e−04DICROCOELIUM0.977290.980480.967513.89e−043.14e−03−5.42e−04Entamoeba coli trophozoite0.991290.992150.98588−1.85e−03−9.26e−043.17e−03Entamoeba histolytica cyst0.937250.945370.901852.47e−03−2.75e−03−2.22e−03Entamoeba histolytica-cyst-Gini0.926370.915250.856011.69e−03−2.96e−03−2.11e−04Entamoeba histolytica trophozoite0.984710.985410.974132.36e−032.87e−039.35e−04Entamoeba histolytica trophozoite_redim0.982530.983070.96996−1.73e−03−2.91e−03−3.19e−04Entamoeba histolytica trophozoite_redim20.986220.98670.975452.20e−031.51e−04−8.70e−05oeuf_ascarisc0.931550.934450.880982.59e−04−1.48e−03−6.88e−04S-Hematobium egg0.885540.923830.8354−1.64e−03−2.70e−03−1.60e−03S-Mansoni egg0.869170.90530.80198−3.42e−034.26e−041.10e−03Tropho_entamoeba_histolytica20.992650.991390.986053.29e−035.36e−051.42e−03Tropho_iodamoeba_butschlii0.99660.996880.99391−4.73e−045.99e−04−1.66e−03Angio0.899050.967950.90462−1.78e−033.27e−03−8.62e−04DisLocElbow0.964460.996660.96081.40e−035.22e−041.54e−03Echo10.889040.87760.82121.77e−03−2.03e−043.88e−04I1_2000.993930.987750.983537.66e−048.84e−041.20e−03Node20.964910.954010.933983.21e−032.26e−03−9.21e−04Ossify0.990170.944110.93032.44e−032.14e−039.73e−04Pelvis0.942990.997540.93903−1.73e−031.78e−03−3.68e−03Ribs0.873220.885880.85227−2.05e−04−8.69e−041.70e−04Dirofilaria0.988140.973630.96349−9.60e−04−8.31e−04−4.47e−04Headirm0.963430.957340.93986−2.08e−036.53e−041.32e−03Abdomenirm0.919290.913310.8508−1.35e−03−6.20e−053.75e−04Pelvisirm0.966020.955670.93225−9.36e−044.49e−042.93e−04Gastrointestinal_parasites0.914040.946140.88418−3.06e−04−2.40e−035.55e−05Echo fetus at 12 weeks0.919430.905560.851167.24e−04−3.15e−03−1.24e−03Ultrasound of fetus of 3 months0.967810.986010.95989−1.85e−03−1.60e−032.34e−03Echopelv0.894280.906120.82813−9.96e−04−1.11e−033.76e−04CT-MONO2-8-abdo0.939170.959150.91275−2.57e−03−3.56e−03−2.56e−04OT-MONO2-8-colon0.961890.965560.93819−2.33e−035.95e−04−4.25e−04Table 6
Correlation coefficients between two vertically, horizontally, and diagonally adjacent pixels in several nonmedical plain images and also in their corresponding encrypted images from database.
Image NameDescriptionCorrelation coefficients of original imagesCorrelation coefficients of cipher imagesVert corHor corDiag corVert corHor corDiag cor4.1.01Girl0.965470.97370.94928-2.94e−041.58e−035.41e−044.1.02Couple0.956150.938890.906582.09e−03-1.85e−049.21e−044.1.03Girl0.914320.975980.89425-4.05e−042.47e−034.50e−044.1.04Girl0.984760.969950.958055.88e−055.11e−04-1.98e−034.1.05House0.952890.97810.94157-3.75e−04-1.20e−032.38e−044.1.06Tree0.94410.966950.9285-2.87e−03-3.22e−035.65e−044.1.07Jelly beans0.982330.97870.964611.58e−03-4.40e−03-2.56e−034.1.08Jelly beans0.975530.972580.952463.56e−03-7.71e−04-6.16e−044.2.01Splash0.99150.983990.980542.25e−04-1.19e−03-8.85e−044.2.02Girl (tiffany)0.940970.938260.91514-2.56e−03-8.88e−041.63e−034.2.03Mandrill (a.k.a. Baboon)0.754860.862690.723241.36e−03-5.84e−04-4.73e−044.2.04Girl (lena. or lena)0.984850.971590.96359.09e−05-2.57e−04-4.52e−044.2.05Airplane (F-16)0.963940.966160.94106-7.67e−042.28e−03-9.57e−054.2.06Sailboat on lake0.970030.973680.957689.21e−045.35e−043.48e−044.2.07Peppers0.977880.975670.968063.40e−03-1.47e−03-3.18e−045.1.09Moon surface0.930930.894440.883853.49e−032.34e−03-1.91e−035.1.10Aerial0.857310.902340.807793.27e−04-1.65e−031.42e−035.1.11Airplane0.937220.956970.913916.44e−04-1.97e−03-1.84e−035.1.12Clock0.973730.956130.93755-1.33e−03-1.34e−031.06e−035.1.13Resolution chart0.866780.872420.757131.78e−038.89e−04-2.11e−045.1.14Chemical plant0.896470.945250.86728.69e−04-3.28e−03-2.29e−035.2.08Couple0.892440.936840.855281.14e−049.13e−041.12e−035.2.09Aerial0.858030.898630.80248-1.94e−03-2.45e−04-6.92e−045.2.10Stream and bridge0.925480.938540.897871.79e−031.26e−038.91e−047.1.01Truck0.917380.959270.90241-1.88e−034.08e−03-1.90e−047.1.02Airplane0.946370.94670.91936-1.35e−032.23e−031.04e−037.1.03Tank0.926650.940730.90446-2.69e−03-3.46e−03-2.49e−037.1.04Car and APCs0.966140.975380.95392-1.17e−036.70e−041.46e−037.1.05Truck and APCs0.906610.936850.88725-4.51e−031.12e−03-8.10e−047.1.06Truck and APCs0.900450.934650.88065-3.92e−036.38e−043.34e−047.1.07Tank0.868130.87680.82074-3.03e−03-2.04e−04-1.32e−037.1.08APC0.924230.953330.91346-1.88e−033.75e−032.08e−047.1.09Tank0.926750.962390.91523-3.11e−031.84e−03-2.76e−037.1.10Car and APCs0.945040.961810.92815-2.16e−04-3.24e−037.66e−04Boat.512Fishing boat0.969930.936380.923085.46e−04-3.22e−031.83e−04Elaine.512Girl (elaine)0.96970.972560.96796-1.19e−035.92e−04-1.12e−03HouseHouse0.950590.973050.938464.29e−03-8.68e−04-2.47e−03Gray21.51221-level step wedge0.999840.996530.996361.55e−03-1.49e−038.19e−04Numbers.512256-level test pattern0.716030.738890.641861.32e−03-3.03e−051.43e−03Azafack0.958720.940020.924291.94e−043.10e−03-5.24e−04Guefack0.990570.990220.984721.60e−035.02e−046.64e−04Figure 5
Correlation of adjacent pixels in «article_oeuf_taeniaC2.jpg image. (a) and (c) The distribution of horizontal and vertical adjacent pixels in the plain image. (b) and (d) The distribution of horizontal and vertical adjacent pixels in the corresponding encrypted image.
(a)(b)(c)(d)


## 3.3.1. Correlation between Plain and Cipher Image

In Table3, the correlation coefficients between plain and cipher images of several medical gray-scale images are given. It is observed that all the correlation coefficients are negligible. The highest value (0, 00348) is obtained for the “ossify” image. The cipher images are not correlated with plain images. The correlation between the decrypted and the original images is always “1” confirming that both images are identical. The algorithm has been applied on other types of nonmedical images. We have used the USC-SIPI image database which is a collection of the digitized image available and maintained by the University of Southern California [42]. Table 4 shows the results of those images. The same as for medical images, correlation coefficients of images in Table 4 are closed to zero. The maximum value (−0, 00504) of the correlation coefficient is very low compared to the critical value (1). This confirms that the proposed algorithm is efficient for every type of image.Table 3
Correlation coefficients and entropy information of some medical images.
Image nameSizeCorrelation coefficients between plain and cipher imagesEntropy value of plain imageEntropy value of cipher imageCorrelation coefficients between plain and decrypted imagesANTAMOEBACOLI398 × 407−1.27e−036.97147.99931article_oeuf_taeniaC2200 × 2003.23e−037.23487.99931Balantidium coli cyst200 × 200−2.54e−037.01187.99931Balantidium coli_trophozoite200 × 200−1.76e−035.67427.99921DICROCOELIUM400 × 3411.66e−036.61757.99941Entamoeba coli trophozoite200 × 200−9.34e−047.12347.99921Entamoeba histolytica cyst200 × 200−1.08e−035.81027.99941Entamoeba histolytica-cyst-Gini130 × 1301.58e−036.50167.99931Entamoeba histolytica trophozoite200 × 2008.49e−047.62177.99941Entamoeba histolytica trophozoite_redim120 × 120−3.26e−037.85227.99921Entamoeba histolytica trophozoite_redim2172 × 1607.73e−057.73677.99931oeuf_ascarisc266 × 200−1.48e−046.91077.99931S- Hematobium egg400 × 300−1.03e−037.19837.99921S- Mansoni egg400 × 3009.58e−046.45617.99931tropho_entamoeba_histolytica2332 × 213−1.99e−033.82347.99931tropho_iodamoeba_butschlii200 × 2007.70e−046.32477.99931Angio64 × 64−3.21e−037.27697.99921DisLocElbow64 × 649.58e−045.53267.99931echo164 × 641.61e−036.32817.99931I1_20064 × 64−7.02e−046.47467.99931Node264 × 64−8.81e−046.87327.99941Ossify64 × 643.48e−036.99897.99931Pelvis64 × 641.29e−036.46537.99931Ribs64 × 641.12e−036.22987.99911Dirofilaria241 × 500−2.59e−036.76667.99931Headirm256 × 2561.38e−035.02997.99931Abdomenirm256 × 256−6.18e−046.95517.99931Pelvisirm256 × 2561.08e−036.73797.99931Gastrointestinal_parasites512 × 3925.58e−077.66347.99941Echo fetus at 12 weeks300 × 2103.41e−046.40627.99931Ultrasound of fetus of 3months512 × 3961.90e−037.29997.99941Echopelv601 × 711−6.74e−046.58967.99981CT-MONO2-8-abdo128 × 128−4.3347e−045.89257.99921OT-MONO2-8-colon128 × 128−2.7e−036.74687.99931Table 4
Correlation coefficients and entropy information of some nonmedical images.
File nameDescriptionSizeCorrelation coefficients between plain and cipher imagesEntropy value of plain imageEntropy value of cipher imageCorrelation coefficients between plain and decrypted images4.1.01Girl256 × 2563.46e−037.18357.999414.1.02Couple256 × 2561.05e−036.50077.999314.1.03Girl256 × 2566.15e−045.95497.999414.1.04Girl256 × 256−2.82e−047.60317.999314.1.05House256 × 2561.95e−037.09027.999314.1.06Tree256 × 256−3.07e−037.56347.999314.1.07Jelly beans256 × 256−1.85e−036.60987.999314.1.08Jelly beans256 × 2561.44e−036.88637.999314.2.01Splash512 × 5129.15e−047.32327.999414.2.02Girl (tiffany)512 × 512−2.28e−036.66917.999314.2.03Mandrill (a.k.a. Baboon)512 × 512−5.77e−047.76597.999314.2.04Girl (lena. or lena)512 × 5124.40e−047.75487.999314.2.05Airplane (F-16)512 × 5121.89e−046.68797.999414.2.06Sailboat on lake512 × 5125.04e−037.76757.999414.2.07Peppers512 × 5122.20e−037.72537.999315.1.09Moon surface256 × 256−1.16e−036.7197.999315.1.10Aerial256 × 2561.71e−037.3227.999215.1.11Airplane256 × 256−3.61e−036.46587.999415.1.12Clock256 × 2561.95e−036.71117.999315.1.13Resolution chart256 × 256−1.47e−032.28637.999415.1.14Chemical plant256 × 2568.36e−057.34737.999315.2.08Couple512 × 512−5.45e−047.21877.999415.2.09Aerial512 × 5121.37e−037.00157.999415.2.10Stream and bridge512 × 512−1.92e−037.7217.999217.1.01Truck512 × 5128.68e−046.58367.999317.1.02Airplane512 × 512−3.11e−055.44087.999317.1.03Tank512 × 512−1.54e−036.40787.999417.1.04Car and APCs512 × 512−1.91e−046.80647.999217.1.05Truck and APCs512 × 512−1.27e−037.11247.999417.1.06Truck and APCs512 × 5122.49e−037.05717.999217.1.07Tank512 × 5122.88e−046.53997.999317.1.08APC512 × 512−2.56e−035.90227.999317.1.09Tank512 × 5121.01e−036.98687.999317.1.10Car and APCs512 × 512−1.11e−036.62017.99941boat.512Fishing boat512 × 5129.47e−047.21517.99921elaine.512Girl (elaine)512 × 5125.99e−047.51187.99921HouseHouse512 × 5121.67e−036.58027.99931gray21.51221 level step wedge512 × 5121.54e−034.59227.99921numbers.512256 level test pattern512 × 512−1.56e−037.77687.99941Azafack398 × 512−1.19e−037.70187.99941Guefack365 × 4868.64e−046.69967.99941


## 3.3.2. Correlation of Adjacent Pixels

Table5 shows the correlation coefficients between two vertically, two horizontally, and two diagonally adjacent pixels in several medical plain images and also in their corresponding encrypted images. A high correlation is noted between vertically, horizontally, and diagonally adjacent pixels of original images. The lower value (0.67636) is obtained between diagonal adjacent pixels on the image «ANTAMOEBACOLI». For encrypted images, these values are approximately zero showing that two vertically, two horizontally, and two diagonally adjacent pixels of encrypted images are not correlated. The highest value (−0, 00514) is obtained in the case of medical images «article_oeuf_taeniaC2». This is a significant feature proving the effectiveness of our cryptosystem. The same observation is made in the case of nonmedical images in Table 6. The proposed cryptosystem produces encrypted images completely different from original images. In Figure 5, we have presented the distribution of horizontally and vertically adjacent pixels in the plain image and its corresponding encrypted image.Table 5
Correlation coefficients between two vertically, horizontally, and diagonally adjacent pixels in several medical plain images and also in their corresponding encrypted images.
Image nameCorrelation coefficients of original imagesCorrelation coefficients of cipher imagesVert. corHor. corDiag. corVert. corHor. corDiag. corANTAMOEBACOLI0.771410.815320.67636−2.96e−031.31e−031.06e−05Article_oeuf_taeniaC20.931070.93080.87861−1.94e−03−5.14e−037.55e−04Balantidium coli cyst0.769530.786130.662311.74e−03−6.15e−046.42e−04Balantidium coli_trophozoite0.92590.932590.905672.19e−03−3.48e−031.56e−04DICROCOELIUM0.977290.980480.967513.89e−043.14e−03−5.42e−04Entamoeba coli trophozoite0.991290.992150.98588−1.85e−03−9.26e−043.17e−03Entamoeba histolytica cyst0.937250.945370.901852.47e−03−2.75e−03−2.22e−03Entamoeba histolytica-cyst-Gini0.926370.915250.856011.69e−03−2.96e−03−2.11e−04Entamoeba histolytica trophozoite0.984710.985410.974132.36e−032.87e−039.35e−04Entamoeba histolytica trophozoite_redim0.982530.983070.96996−1.73e−03−2.91e−03−3.19e−04Entamoeba histolytica trophozoite_redim20.986220.98670.975452.20e−031.51e−04−8.70e−05oeuf_ascarisc0.931550.934450.880982.59e−04−1.48e−03−6.88e−04S-Hematobium egg0.885540.923830.8354−1.64e−03−2.70e−03−1.60e−03S-Mansoni egg0.869170.90530.80198−3.42e−034.26e−041.10e−03Tropho_entamoeba_histolytica20.992650.991390.986053.29e−035.36e−051.42e−03Tropho_iodamoeba_butschlii0.99660.996880.99391−4.73e−045.99e−04−1.66e−03Angio0.899050.967950.90462−1.78e−033.27e−03−8.62e−04DisLocElbow0.964460.996660.96081.40e−035.22e−041.54e−03Echo10.889040.87760.82121.77e−03−2.03e−043.88e−04I1_2000.993930.987750.983537.66e−048.84e−041.20e−03Node20.964910.954010.933983.21e−032.26e−03−9.21e−04Ossify0.990170.944110.93032.44e−032.14e−039.73e−04Pelvis0.942990.997540.93903−1.73e−031.78e−03−3.68e−03Ribs0.873220.885880.85227−2.05e−04−8.69e−041.70e−04Dirofilaria0.988140.973630.96349−9.60e−04−8.31e−04−4.47e−04Headirm0.963430.957340.93986−2.08e−036.53e−041.32e−03Abdomenirm0.919290.913310.8508−1.35e−03−6.20e−053.75e−04Pelvisirm0.966020.955670.93225−9.36e−044.49e−042.93e−04Gastrointestinal_parasites0.914040.946140.88418−3.06e−04−2.40e−035.55e−05Echo fetus at 12 weeks0.919430.905560.851167.24e−04−3.15e−03−1.24e−03Ultrasound of fetus of 3 months0.967810.986010.95989−1.85e−03−1.60e−032.34e−03Echopelv0.894280.906120.82813−9.96e−04−1.11e−033.76e−04CT-MONO2-8-abdo0.939170.959150.91275−2.57e−03−3.56e−03−2.56e−04OT-MONO2-8-colon0.961890.965560.93819−2.33e−035.95e−04−4.25e−04Table 6
Correlation coefficients between two vertically, horizontally, and diagonally adjacent pixels in several nonmedical plain images and also in their corresponding encrypted images from database.
Image NameDescriptionCorrelation coefficients of original imagesCorrelation coefficients of cipher imagesVert corHor corDiag corVert corHor corDiag cor4.1.01Girl0.965470.97370.94928-2.94e−041.58e−035.41e−044.1.02Couple0.956150.938890.906582.09e−03-1.85e−049.21e−044.1.03Girl0.914320.975980.89425-4.05e−042.47e−034.50e−044.1.04Girl0.984760.969950.958055.88e−055.11e−04-1.98e−034.1.05House0.952890.97810.94157-3.75e−04-1.20e−032.38e−044.1.06Tree0.94410.966950.9285-2.87e−03-3.22e−035.65e−044.1.07Jelly beans0.982330.97870.964611.58e−03-4.40e−03-2.56e−034.1.08Jelly beans0.975530.972580.952463.56e−03-7.71e−04-6.16e−044.2.01Splash0.99150.983990.980542.25e−04-1.19e−03-8.85e−044.2.02Girl (tiffany)0.940970.938260.91514-2.56e−03-8.88e−041.63e−034.2.03Mandrill (a.k.a. Baboon)0.754860.862690.723241.36e−03-5.84e−04-4.73e−044.2.04Girl (lena. or lena)0.984850.971590.96359.09e−05-2.57e−04-4.52e−044.2.05Airplane (F-16)0.963940.966160.94106-7.67e−042.28e−03-9.57e−054.2.06Sailboat on lake0.970030.973680.957689.21e−045.35e−043.48e−044.2.07Peppers0.977880.975670.968063.40e−03-1.47e−03-3.18e−045.1.09Moon surface0.930930.894440.883853.49e−032.34e−03-1.91e−035.1.10Aerial0.857310.902340.807793.27e−04-1.65e−031.42e−035.1.11Airplane0.937220.956970.913916.44e−04-1.97e−03-1.84e−035.1.12Clock0.973730.956130.93755-1.33e−03-1.34e−031.06e−035.1.13Resolution chart0.866780.872420.757131.78e−038.89e−04-2.11e−045.1.14Chemical plant0.896470.945250.86728.69e−04-3.28e−03-2.29e−035.2.08Couple0.892440.936840.855281.14e−049.13e−041.12e−035.2.09Aerial0.858030.898630.80248-1.94e−03-2.45e−04-6.92e−045.2.10Stream and bridge0.925480.938540.897871.79e−031.26e−038.91e−047.1.01Truck0.917380.959270.90241-1.88e−034.08e−03-1.90e−047.1.02Airplane0.946370.94670.91936-1.35e−032.23e−031.04e−037.1.03Tank0.926650.940730.90446-2.69e−03-3.46e−03-2.49e−037.1.04Car and APCs0.966140.975380.95392-1.17e−036.70e−041.46e−037.1.05Truck and APCs0.906610.936850.88725-4.51e−031.12e−03-8.10e−047.1.06Truck and APCs0.900450.934650.88065-3.92e−036.38e−043.34e−047.1.07Tank0.868130.87680.82074-3.03e−03-2.04e−04-1.32e−037.1.08APC0.924230.953330.91346-1.88e−033.75e−032.08e−047.1.09Tank0.926750.962390.91523-3.11e−031.84e−03-2.76e−037.1.10Car and APCs0.945040.961810.92815-2.16e−04-3.24e−037.66e−04Boat.512Fishing boat0.969930.936380.923085.46e−04-3.22e−031.83e−04Elaine.512Girl (elaine)0.96970.972560.96796-1.19e−035.92e−04-1.12e−03HouseHouse0.950590.973050.938464.29e−03-8.68e−04-2.47e−03Gray21.51221-level step wedge0.999840.996530.996361.55e−03-1.49e−038.19e−04Numbers.512256-level test pattern0.716030.738890.641861.32e−03-3.03e−051.43e−03Azafack0.958720.940020.924291.94e−043.10e−03-5.24e−04Guefack0.990570.990220.984721.60e−035.02e−046.64e−04Figure 5
Correlation of adjacent pixels in «article_oeuf_taeniaC2.jpg image. (a) and (c) The distribution of horizontal and vertical adjacent pixels in the plain image. (b) and (d) The distribution of horizontal and vertical adjacent pixels in the corresponding encrypted image.
(a)(b)(c)(d)


## 3.4. Histograms

The histograms of both the plain and the encrypted images using our proposed method are shown in Figure6. The histograms of the encrypted images are uniformly distributed while those of plain images are not. This confirms the toughness of the method over any statistical attack. The security of the encryption method is therefore very strong.Figure 6
Histogram analysis plain and cipher images using the secret key «A23C56789ABADEF7167DEAB6789367A9»: (a), (b), (c), and (d) A plain image “Balantidium Coli cyst” and its corresponding histogram, cipher image, and cipher image histogram, respectively. (e), (f), (g), and (h) A plain image “echopelv» and its corresponding histogram, cipher image, and cipher image histogram, respectively. (i), (j), (k), and (l) A plain image “Girl (Lena, 4.2.04)» and its corresponding histogram, cipher image, and cipher image histogram, respectively. (m), (n), (o), and (p) A plain image “Guefack» and its corresponding histogram, cipher image, and cipher image histogram, respectively.
(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)(l)(m)(n)(o)(p)


## 3.5. Key Sensitivity Test

An ideal cipher image should be extremely sensitive with respect to the key used in the algorithm during the encryption and decryption processes.


### 3.5.1. Key Sensitivity Test of Encryption Process

An insignificant change in the encryption key should be sensitive to the cipher images. We take out the key sensitivity test during the encryption process by using different keys to encrypt the same image. The difference between keys is a single bit change. The procedure is described as follows:(a)
We used «A23C56789ABADEF7167DEAB6789367A9» as first external key to encrypt«S-Hematobium egg» image. The encrypted image is presented on Figure7(b).(b)
We change a single bit on the external key by substituting the fourth character “C” into “D.” The external key in this case becomes «A23D56789ABADEF7167DEAB6789367A9». The obtained encrypted image is presented on Figure7(c).(c)
In the second case, we change the sixteenth character 7 in the external key into 6. The used external key is then«A23C56789ABADEF6167DEAB6789367A9». The encrypted image is shown in Figure 7(d).(d)
In the test number 3, the used external key is changed into«A23C56789ABADEF7167DEAB6789367AA». Here, the last character 9 in the first external key is changed into A. Figure 7(e) presents a cipher image obtained.(e)
For the last test, the second character 2 in the external key is changed into 3. The used external key becomes «A33C56789ABADEF7167DEAB6789367A9». Figure7(f) presents a cipher image obtained.Figure 7
Plain and cipher images. (a) The plain image of «S-Hematobium egg». (b) to (f) The different cipher images obtained with different external keys.
(a)(b)(c)(d)(e)(f)For a quantitative assessment of the similarity between those images, we present in Table7 the correlation coefficients between the different cipher images.Table 7
Correlation coefficients between various cipher images presented in Figure7
ImagesCorrelation coefficientsFigures6(a) and 6(b)−0.0010Figures6(a) and 6(c)−6.6046e−04Figures6(a) and 6(d)−2.6622e−04Figures6(a) and 6(e)1.4038e−04Figures6(a) and 6(f)0.0014Figures6(b) and 6(c)5.5615e−04Figures6(b) and 6(d)0.0031Figures6(b) and 6(e)0.0027Figures6(b) and 6(f)−0.0016Figures6(c) and 6(d)0.0041Figures6(c) and 6(e)−0.0022Figures6(c) and 6(f)8.2013e−04Figures6(d) and 6(e)−5.3809e−04Figures6(d) and 6(f)8.4005e−04Figures6(e) and 6(f)−6.3580e−04Although the difference from one key to the other is a single bit, we note from Table7 that the values of the correlations’ coefficients between the different encrypted images obtained are closed to zero. The highest correlation value obtained is 0.0041. This test was performed on several other images and all the results are conclusive. This implies that the encrypted images produced from the proposed cryptosystem are different. This means that the proposed cryptosystem is very sensitive to the encryption key.


### 3.5.2. Key Sensitivity Test of Decryption Process

In a robust encryption scheme, an insignificant change in the key should not let to the decryption of the cipher image successfully [17]. The key sensitivity test was performed using a slightly different external key to decrypt the encrypted images. Some examples are given below. A “ultrasound of fetus of 3 months” image (Figure 8(a)) has been encrypted using the proposed cryptosystem where the external key is “A23C56789ABADEF7167DEAB6789367A9». The encrypted image is shown in Figure 8(b).(a)
Firstly, the encrypted image (Figure8(b)) is decrypted with a decrypted external key «A23D56789ABADEF7167DEAB6789367A9» which is different to the encryption external key «A23C56789ABADEF7167DEAB6789367A9» by a single bit. The fourth character C in the encryption external key is changed into D in the decryption external key. The decrypted image is shown in Figure 8(c).(b)
In the second test, the encrypted image (Figure8(b)) is decrypted by using «A23C56789ABADEF6167DEAB6789367A9» as the external key. The sixteenth character 7 in the encryption external key is changed into 6 in the decryption external key. The decrypted image is shown in Figure 8(d).(c)
In this case, the encrypted image (Figure8(b)) is decrypted using the decrypted external key «A23C56789ABADEF7167DEAB6789367AA». The last character 9 in the encryption external key is changed into A in the decryption external key. Figure 8(e) shows the decrypted image which is not correlated with the original image.(d)
In Figure8, Figure 8(b) has been decrypted using «A33C56789ABADEF7167DEAB6789367A9» as the decrypted external key. The second character 2 in the encryption external key is changed into 3 in the decryption external key.Figure 8
(a and b) The plain image from “ultrasound of fetus of 3 months” image and its corresponding encrypted image. (c)-(f) The decrypted images from the encrypted image of Figure8(b) using slightly different decryption keys than the key used for encryption.
(a)(b)(c)(d)(e)(f)Physically, the decrypted images are not similar to a plain image “ultrasound of fetus of 3 months,” as we can see in Figure 8. The correlation coefficients between the plain image and the decrypted images using a slightly different key have been calculated. They are all closed to zero as we can see in Table 8. Any change on an external secret key affects the angle of the eight used rotations and changes an internal key. Consequently, the resulting substitution-diffusion key is modified. It comes out that, without an exact key, one cannot succeed in the decryption process. This confirms the effectiveness and key sensitivity of the proposed algorithm.Table 8
Correlation coefficients between various decrypted images shown in Figure8.
ImagesCorrelation coefficientsFigures7(a) and 7(b)0.0019Figures7(a) and 7(c)−5.0690e−04Figures7(a) and 7(d)9.6489e−04Figures7(a) and 7(e)−5.8923e−04Figures7(a) and 7(f)1.4796e−04Figures7(b) and 7(c)−0.0014Figures7(b) and 7(d)−0.0014Figures7(b) and 7(e)8.0764e−04Figures7(b) and 7(f)−0.0018Figures7(c) and 7(d)−0.0016Figures7(c) and 7(e)−1.0391e−04Figures7(c) and 7(f)0.0030Figures7(d) and 7(e)0.0038Figures7(d) and 7(f)0.0024Figures7(e) and 7(f)8.9324e−04So, the proposed cryptosystem is very sensitive to the encryption and decryption of external keys.


## 3.5.1. Key Sensitivity Test of Encryption Process

An insignificant change in the encryption key should be sensitive to the cipher images. We take out the key sensitivity test during the encryption process by using different keys to encrypt the same image. The difference between keys is a single bit change. The procedure is described as follows:(a)
We used «A23C56789ABADEF7167DEAB6789367A9» as first external key to encrypt«S-Hematobium egg» image. The encrypted image is presented on Figure7(b).(b)
We change a single bit on the external key by substituting the fourth character “C” into “D.” The external key in this case becomes «A23D56789ABADEF7167DEAB6789367A9». The obtained encrypted image is presented on Figure7(c).(c)
In the second case, we change the sixteenth character 7 in the external key into 6. The used external key is then«A23C56789ABADEF6167DEAB6789367A9». The encrypted image is shown in Figure 7(d).(d)
In the test number 3, the used external key is changed into«A23C56789ABADEF7167DEAB6789367AA». Here, the last character 9 in the first external key is changed into A. Figure 7(e) presents a cipher image obtained.(e)
For the last test, the second character 2 in the external key is changed into 3. The used external key becomes «A33C56789ABADEF7167DEAB6789367A9». Figure7(f) presents a cipher image obtained.Figure 7
Plain and cipher images. (a) The plain image of «S-Hematobium egg». (b) to (f) The different cipher images obtained with different external keys.
(a)(b)(c)(d)(e)(f)For a quantitative assessment of the similarity between those images, we present in Table7 the correlation coefficients between the different cipher images.Table 7
Correlation coefficients between various cipher images presented in Figure7
ImagesCorrelation coefficientsFigures6(a) and 6(b)−0.0010Figures6(a) and 6(c)−6.6046e−04Figures6(a) and 6(d)−2.6622e−04Figures6(a) and 6(e)1.4038e−04Figures6(a) and 6(f)0.0014Figures6(b) and 6(c)5.5615e−04Figures6(b) and 6(d)0.0031Figures6(b) and 6(e)0.0027Figures6(b) and 6(f)−0.0016Figures6(c) and 6(d)0.0041Figures6(c) and 6(e)−0.0022Figures6(c) and 6(f)8.2013e−04Figures6(d) and 6(e)−5.3809e−04Figures6(d) and 6(f)8.4005e−04Figures6(e) and 6(f)−6.3580e−04Although the difference from one key to the other is a single bit, we note from Table7 that the values of the correlations’ coefficients between the different encrypted images obtained are closed to zero. The highest correlation value obtained is 0.0041. This test was performed on several other images and all the results are conclusive. This implies that the encrypted images produced from the proposed cryptosystem are different. This means that the proposed cryptosystem is very sensitive to the encryption key.


## 3.5.2. Key Sensitivity Test of Decryption Process

In a robust encryption scheme, an insignificant change in the key should not let to the decryption of the cipher image successfully [17]. The key sensitivity test was performed using a slightly different external key to decrypt the encrypted images. Some examples are given below. A “ultrasound of fetus of 3 months” image (Figure 8(a)) has been encrypted using the proposed cryptosystem where the external key is “A23C56789ABADEF7167DEAB6789367A9». The encrypted image is shown in Figure 8(b).(a)
Firstly, the encrypted image (Figure8(b)) is decrypted with a decrypted external key «A23D56789ABADEF7167DEAB6789367A9» which is different to the encryption external key «A23C56789ABADEF7167DEAB6789367A9» by a single bit. The fourth character C in the encryption external key is changed into D in the decryption external key. The decrypted image is shown in Figure 8(c).(b)
In the second test, the encrypted image (Figure8(b)) is decrypted by using «A23C56789ABADEF6167DEAB6789367A9» as the external key. The sixteenth character 7 in the encryption external key is changed into 6 in the decryption external key. The decrypted image is shown in Figure 8(d).(c)
In this case, the encrypted image (Figure8(b)) is decrypted using the decrypted external key «A23C56789ABADEF7167DEAB6789367AA». The last character 9 in the encryption external key is changed into A in the decryption external key. Figure 8(e) shows the decrypted image which is not correlated with the original image.(d)
In Figure8, Figure 8(b) has been decrypted using «A33C56789ABADEF7167DEAB6789367A9» as the decrypted external key. The second character 2 in the encryption external key is changed into 3 in the decryption external key.Figure 8
(a and b) The plain image from “ultrasound of fetus of 3 months” image and its corresponding encrypted image. (c)-(f) The decrypted images from the encrypted image of Figure8(b) using slightly different decryption keys than the key used for encryption.
(a)(b)(c)(d)(e)(f)Physically, the decrypted images are not similar to a plain image “ultrasound of fetus of 3 months,” as we can see in Figure 8. The correlation coefficients between the plain image and the decrypted images using a slightly different key have been calculated. They are all closed to zero as we can see in Table 8. Any change on an external secret key affects the angle of the eight used rotations and changes an internal key. Consequently, the resulting substitution-diffusion key is modified. It comes out that, without an exact key, one cannot succeed in the decryption process. This confirms the effectiveness and key sensitivity of the proposed algorithm.Table 8
Correlation coefficients between various decrypted images shown in Figure8.
ImagesCorrelation coefficientsFigures7(a) and 7(b)0.0019Figures7(a) and 7(c)−5.0690e−04Figures7(a) and 7(d)9.6489e−04Figures7(a) and 7(e)−5.8923e−04Figures7(a) and 7(f)1.4796e−04Figures7(b) and 7(c)−0.0014Figures7(b) and 7(d)−0.0014Figures7(b) and 7(e)8.0764e−04Figures7(b) and 7(f)−0.0018Figures7(c) and 7(d)−0.0016Figures7(c) and 7(e)−1.0391e−04Figures7(c) and 7(f)0.0030Figures7(d) and 7(e)0.0038Figures7(d) and 7(f)0.0024Figures7(e) and 7(f)8.9324e−04So, the proposed cryptosystem is very sensitive to the encryption and decryption of external keys.


## 3.6. Attack Analyses

### 3.6.1. Entropy Information Analysis

It comes out from Tables3 and 4 that the values of entropy information obtained with our new proposed scheme on medical and nonmedical images are very close to 8. The highest value is 7.9998 and the lowest one is 7.9991 for medical images, while the lowest value is 7.9992 and the highest value is 7.9994 for nonmedical images. These values are very close to eight (ideal value) compared to the entropy of the original images. This indicates that the proposed algorithm has hidden information randomly, and information leakage in the encryption process is negligible. We evaluated the local entropy of many images using TB = 1936 as in [43], and the results are presented in Table 9. We conclude the effectiveness of the algorithm considering the high values of entropy information and the local entropy.Table 9
Local entropies for the cipher images.
ImagesBalantidium coli cyst (200 × 200)Echopelv (601 × 711)Girl (lena, 4.2.04) (512 × 512)Guefack (365 × 486)Local entropy information7.90887.90817.90917.9085


### 3.6.2. Differential Attacks

Tables10 and 11 present the values of the Number of Pixels Change Rate (NPCR) and Unified Average Changing Intensity (UACI) for medical and nonmedical images.Table 10
Values of the number of pixels change rate (NPCR) and unified average changing intensity (UACI) in several medical images.
Image nameCorr (A.B)NCPRUACIMSEPSNRANTAMOEBACOLI−1.72e−0399.616633.46130∞article_oeuf_taeniaC21.26e−0399.622733.44760∞Balantidium coli cyst−1.43e−0399.608233.46470∞Balantidium coli_trophozoite3.73e−0499.604433.44870∞DICROCOELIUM−5.02e−0499.60433.45730∞Entamoeba coli trophozoite7.61e−0499.620133.46610∞Entamoeba histolytica cyst−1.82e−0399.610533.53860∞Entamoeba histolytica-cyst-Gini−2.94e−0399.615933.54020∞Entamoeba histolytica trophozoite6.55e−0499.612433.45650∞Entamoeba histolytica trophozoite_redim8.47e−0499.606733.45920∞Entamoeba histolytica trophozoite_redim22.35e−0499.598733.46620∞Oeuf_ascarisc7.00e−0499.613233.48180∞S-Hematobium egg−1.13e−0399.612433.440∞S- Mansoni egg−1.20e−0399.60433.52290∞Tropho_entamoeba_histolytica21.82e−0399.613233.43280∞Tropho_iodamoeba_butschlii1.46e−0499.592633.4720∞Angio5.33e−0499.598333.43290∞DisLocElbow−1.62e−0399.623533.45760∞Echo17.11e−0499.616633.48190∞I1_200−3.09e−0399.605933.55450∞Node29.36e−0499.607533.46140∞Ossify−7.55e−0499.622733.51450∞Pelvis−3.33e−0399.622733.47520∞Ribs3.25e−0399.613633.40690∞Dirofilaria2.97e−0499.615133.47110∞Headirm1.65e−0499.599133.45990∞Abdomenirm−2.53e−0499.621233.4780∞Pelvisirm3.67e−0399.586933.37660∞Gastrointestinal_parasites−1.53e−0399.623533.44980∞Echo fetus at 12 weeks3.31e−0399.618933.43430∞Ultrasound of fetus of 3 months−2.24e−0399.597933.51960∞Echopelv1.79e−0599.600733.46570∞CT-MONO2-8-abdo−4.7542e−0499.61733.46360∞OT-MONO2-8-colon−1.6e−0399.612433.4980∞Table 11
Values of the number of pixels’ change rate (NPCR) and unified average changing intensity (UACI) in several nonmedical images.
File nameDescriptionSizeCorr (A.B)NCPRUACIMSEPSNR4.1.01Girl256 × 256−1.35e−0399.599533.4520∞4.1.02Couple256 × 256−9.35e−0499.611733.49130∞4.1.03Girl256 × 256−1.38e−0399.617833.50030∞4.1.04Girl256 × 2565.57e−0499.613633.47340∞4.1.05House256 × 256−6.70e−0599.601733.4810∞4.1.06Tree256 × 256−3.04e−0399.616633.53540∞4.1.07Jelly beans256 × 2563.16e−0399.61433.43570∞4.1.08Jelly beans256 × 2562.05e−0399.60433.42720∞4.2.01Splash512 × 5129.57e−0499.61233.43380∞4.2.02Girl (tiffany)512 × 5122.78e−0399.610533.39750∞4.2.03Mandrill (a.k.a. Baboon)512 × 5121.94e−0499.606333.43530∞4.2.04Girl (lena. or lena)512 × 5125.32e−-0499.625433.46040∞4.2.05Airplane (F-16)512 × 5121.45e−0399.60433.44260∞4.2.06Sailboat on lake512 × 5121.39e−0499.60933.45130∞4.2.07Peppers512 × 512−1.55e−0399.610533.51160∞5.1.09Moon surface256 × 2562.42e−0399.616633.4340∞5.1.10Aerial256 × 2562.44e−0399.626233.42090∞5.1.11Airplane256 × 2566.09e−0499.608233.48210∞5.1.12Clock256 × 2561.58e−0399.591833.41260∞5.1.13Resolution chart256 × 256−2.49e−0399.610133.53350∞5.1.14Chemical plant256 × 2563.96e−0399.634633.3430∞5.2.08Couple512 × 5128.94e−0499.595633.41830∞5.2.09Aerial512 × 5124.95b0399.611333.35980∞5.2.10Stream and bridge512 × 512−7.71e−0499.611733.51070∞7.1.01Truck512 × 5126.92e−0499.602533.43770∞7.1.02Airplane512 × 5122.96e−0399.604433.40760∞7.1.03Tank512 × 512−6.64e−0499.615933.46960∞7.1.04Car and APCs512 × 5122.12e−0399.610533.43040∞7.1.05Truck and APCs512 × 5127.08e−0499.625433.40410∞7.1.06Truck and APCs512 × 512−4.98e−0499.594133.50410∞7.1.07Tank512 × 5127.41e−0499.617833.44290∞7.1.08APC512 × 512−1.30e−0599.59633.45920∞7.1.09Tank512 × 512−6.91e−0499.618533.49670∞7.1.10Car and APCs512 × 5122.65e−0399.593733.39730∞Boat.512Fishing boat512 × 5121.10e−0399.63333.41210∞Elaine.512Girl (elaine)512 × 512−3.55e−0399.61233.4750∞HouseHouse512 × 5122.72e−0499.617433.44480∞Gray21.51221-level step wedge512 × 512−4.65e−0499.615933.4460∞Numbers.512256-level test pattern512 × 5121.07e−0399.624333.44080∞Azafack398 × 5121.97e−0499.610933.44390∞Guefack365 × 4862.72e−0399.593433.35930∞In all the cases tested, the NPCR values are closed to 99.6% and the UACI is found close to 33.33%. Our new algorithm is very sensitive with respect to a small percentage of pixels’ change in the plain image and the rate of influence because one-pixel change in the plain image is very high. According to Tables10 and 11, the correlation coefficients between the cipher images are negligible. So, a minor pixel change in the plain image has an important effect on the cipher image. The proposed encryption scheme is sensitive to a minor change in the plain image.We have evaluated MSE and PSNR on all test images; the MSE is zero in all the cases and the PSNR is infinite, as we can see in Tables10 and 11. The original and the decrypted image are identical in all cases.


## 3.6.1. Entropy Information Analysis

It comes out from Tables3 and 4 that the values of entropy information obtained with our new proposed scheme on medical and nonmedical images are very close to 8. The highest value is 7.9998 and the lowest one is 7.9991 for medical images, while the lowest value is 7.9992 and the highest value is 7.9994 for nonmedical images. These values are very close to eight (ideal value) compared to the entropy of the original images. This indicates that the proposed algorithm has hidden information randomly, and information leakage in the encryption process is negligible. We evaluated the local entropy of many images using TB = 1936 as in [43], and the results are presented in Table 9. We conclude the effectiveness of the algorithm considering the high values of entropy information and the local entropy.Table 9
Local entropies for the cipher images.
ImagesBalantidium coli cyst (200 × 200)Echopelv (601 × 711)Girl (lena, 4.2.04) (512 × 512)Guefack (365 × 486)Local entropy information7.90887.90817.90917.9085


## 3.6.2. Differential Attacks

Tables10 and 11 present the values of the Number of Pixels Change Rate (NPCR) and Unified Average Changing Intensity (UACI) for medical and nonmedical images.Table 10
Values of the number of pixels change rate (NPCR) and unified average changing intensity (UACI) in several medical images.
Image nameCorr (A.B)NCPRUACIMSEPSNRANTAMOEBACOLI−1.72e−0399.616633.46130∞article_oeuf_taeniaC21.26e−0399.622733.44760∞Balantidium coli cyst−1.43e−0399.608233.46470∞Balantidium coli_trophozoite3.73e−0499.604433.44870∞DICROCOELIUM−5.02e−0499.60433.45730∞Entamoeba coli trophozoite7.61e−0499.620133.46610∞Entamoeba histolytica cyst−1.82e−0399.610533.53860∞Entamoeba histolytica-cyst-Gini−2.94e−0399.615933.54020∞Entamoeba histolytica trophozoite6.55e−0499.612433.45650∞Entamoeba histolytica trophozoite_redim8.47e−0499.606733.45920∞Entamoeba histolytica trophozoite_redim22.35e−0499.598733.46620∞Oeuf_ascarisc7.00e−0499.613233.48180∞S-Hematobium egg−1.13e−0399.612433.440∞S- Mansoni egg−1.20e−0399.60433.52290∞Tropho_entamoeba_histolytica21.82e−0399.613233.43280∞Tropho_iodamoeba_butschlii1.46e−0499.592633.4720∞Angio5.33e−0499.598333.43290∞DisLocElbow−1.62e−0399.623533.45760∞Echo17.11e−0499.616633.48190∞I1_200−3.09e−0399.605933.55450∞Node29.36e−0499.607533.46140∞Ossify−7.55e−0499.622733.51450∞Pelvis−3.33e−0399.622733.47520∞Ribs3.25e−0399.613633.40690∞Dirofilaria2.97e−0499.615133.47110∞Headirm1.65e−0499.599133.45990∞Abdomenirm−2.53e−0499.621233.4780∞Pelvisirm3.67e−0399.586933.37660∞Gastrointestinal_parasites−1.53e−0399.623533.44980∞Echo fetus at 12 weeks3.31e−0399.618933.43430∞Ultrasound of fetus of 3 months−2.24e−0399.597933.51960∞Echopelv1.79e−0599.600733.46570∞CT-MONO2-8-abdo−4.7542e−0499.61733.46360∞OT-MONO2-8-colon−1.6e−0399.612433.4980∞Table 11
Values of the number of pixels’ change rate (NPCR) and unified average changing intensity (UACI) in several nonmedical images.
File nameDescriptionSizeCorr (A.B)NCPRUACIMSEPSNR4.1.01Girl256 × 256−1.35e−0399.599533.4520∞4.1.02Couple256 × 256−9.35e−0499.611733.49130∞4.1.03Girl256 × 256−1.38e−0399.617833.50030∞4.1.04Girl256 × 2565.57e−0499.613633.47340∞4.1.05House256 × 256−6.70e−0599.601733.4810∞4.1.06Tree256 × 256−3.04e−0399.616633.53540∞4.1.07Jelly beans256 × 2563.16e−0399.61433.43570∞4.1.08Jelly beans256 × 2562.05e−0399.60433.42720∞4.2.01Splash512 × 5129.57e−0499.61233.43380∞4.2.02Girl (tiffany)512 × 5122.78e−0399.610533.39750∞4.2.03Mandrill (a.k.a. Baboon)512 × 5121.94e−0499.606333.43530∞4.2.04Girl (lena. or lena)512 × 5125.32e−-0499.625433.46040∞4.2.05Airplane (F-16)512 × 5121.45e−0399.60433.44260∞4.2.06Sailboat on lake512 × 5121.39e−0499.60933.45130∞4.2.07Peppers512 × 512−1.55e−0399.610533.51160∞5.1.09Moon surface256 × 2562.42e−0399.616633.4340∞5.1.10Aerial256 × 2562.44e−0399.626233.42090∞5.1.11Airplane256 × 2566.09e−0499.608233.48210∞5.1.12Clock256 × 2561.58e−0399.591833.41260∞5.1.13Resolution chart256 × 256−2.49e−0399.610133.53350∞5.1.14Chemical plant256 × 2563.96e−0399.634633.3430∞5.2.08Couple512 × 5128.94e−0499.595633.41830∞5.2.09Aerial512 × 5124.95b0399.611333.35980∞5.2.10Stream and bridge512 × 512−7.71e−0499.611733.51070∞7.1.01Truck512 × 5126.92e−0499.602533.43770∞7.1.02Airplane512 × 5122.96e−0399.604433.40760∞7.1.03Tank512 × 512−6.64e−0499.615933.46960∞7.1.04Car and APCs512 × 5122.12e−0399.610533.43040∞7.1.05Truck and APCs512 × 5127.08e−0499.625433.40410∞7.1.06Truck and APCs512 × 512−4.98e−0499.594133.50410∞7.1.07Tank512 × 5127.41e−0499.617833.44290∞7.1.08APC512 × 512−1.30e−0599.59633.45920∞7.1.09Tank512 × 512−6.91e−0499.618533.49670∞7.1.10Car and APCs512 × 5122.65e−0399.593733.39730∞Boat.512Fishing boat512 × 5121.10e−0399.63333.41210∞Elaine.512Girl (elaine)512 × 512−3.55e−0399.61233.4750∞HouseHouse512 × 5122.72e−0499.617433.44480∞Gray21.51221-level step wedge512 × 512−4.65e−0499.615933.4460∞Numbers.512256-level test pattern512 × 5121.07e−0399.624333.44080∞Azafack398 × 5121.97e−0499.610933.44390∞Guefack365 × 4862.72e−0399.593433.35930∞In all the cases tested, the NPCR values are closed to 99.6% and the UACI is found close to 33.33%. Our new algorithm is very sensitive with respect to a small percentage of pixels’ change in the plain image and the rate of influence because one-pixel change in the plain image is very high. According to Tables10 and 11, the correlation coefficients between the cipher images are negligible. So, a minor pixel change in the plain image has an important effect on the cipher image. The proposed encryption scheme is sensitive to a minor change in the plain image.We have evaluated MSE and PSNR on all test images; the MSE is zero in all the cases and the PSNR is infinite, as we can see in Tables10 and 11. The original and the decrypted image are identical in all cases.


## 4. Discussion

This work proposes a new image encryption algorithm which does not use chaotic functions or mathematical functions which are time-consuming and make the algorithm too complex. It uses an external key of 128 bit size and an internal key. The originality of this method dwells on the combination of external and internal keys and the use of reflection or rotation mapping and the method to apply substitution and zigzag processes. An internal key comes from the decomposition of an image to be encrypted. The method to extract an internal key has been explained in Section2. This internal key is the first level to ensure the security of the proposed system. To increase the security of this system, we combine the two keys to produce the diffusion-substitution sequences. These two aspects are the first novelty of the work. The second novelty comes from binary image processing. Each binary image is reshuffled within the block by the zigzag path. The corresponding reflections and rotations are applied to binary images obtained from the decomposition of the original image. It is also the case during the subblock substitution process. The scan zigzag process is applied not on the pixels of the subblock but on the bits of the pixel. The new pixel block is reconstructed. Consequently, the zigzag operation changes the values of the pixels and acts as a substitution process. In image encryption algorithm, the size of the external key, the size of subblock, the number of the subblock, the number of the rounds on each subblock, the variation of the key from one subblock to another one and from one round to another one, the generator used to generate sequences for the substitution-diffusion process, and the encryption scheme are the factors that provide to the security, efficiency, and robustness to the method. The encryption method proposed in this work is based on these parameters; when they are not enough, one can easily cryptanalyse the cipher image during transmission. These features and the obtained results make the proposed system resistant to any kind of attack while complicating the task of cryptanalysis. Certainly, our algorithm is not very fast as the others, but we fight against cryptanalysis, and we gain on efficiency and security. Table 12 presents the comparison of the results with those obtained in [28, 33, 37, 38, 44] by presenting the correlation coefficient between vertically, horizontally, and diagonally adjacent pixels of plain and cipher image, entropy, NPCR, and UACIA of “Lena, Airplane and Baboon” images.Table 12
Comparison of results on nonmedical images.
ImageMetricCipher image [34]Cipher image [38]Cipher image [39]Cipher image [29]Cipher image [44]Cipher image of our algorithmLenaVert. cor−0.00240.0037090.00085−0.00160.00349,09e−05Hor. cor0.0076−0.000840.000800.00310.0026−0.000257Diag. cor0.003−0.000180.000190.00670.0019−0.000452Entropy7.9992 < e < 7.99947.997487.99527.99927.9993NPCR93,7457>99.699.6553>9699,620199.6254UACI32.389933.433.337731,7933,400633.4604Airplane (512 × 512)Vert. cor−0.0095−0.0036−0.000767Hor. cor0.0025−0.00170.00228Diag. cor0.0009−0.0020−9.57e−05Entropy7.9992 < e < 7.99947.999257.99907.9994NPCR93.748299.525299.617899.604UACI32.329333.3833.58933.4426BaboonVert. cor−0.0092−0.00190.00136Hor. cor0.0019−0.0014−0.000584Diag. cor0.0049−0.0013−0.000473Entropy7.9992 < e < 7.99947.99937.99917.9993NPCR93.748399.993599.610999.6063UACI31.760233.6933.475733.4353Our algorithm gives the best vertical correlation coefficient (9.09e−05 for “Lena” image, −0.000767 for “Airplane “image, and 0.00136 for “Baboon” image). In terms of horizontal correlation coefficient, the proposed algorithm also gives the best results (0.000257 for “Lena” image and −0.000584 for “Baboon” image). In [44], the horizontal correlation coefficient on “Airplane “image is low (0.0017 compare to ours 0.00228), but we have a high entropy value (7.994 compared to theirs 7.990). For diagonal correlation coefficient obtained in [37] is the lowest (−0.00018) on «Lena» image, but the proposed algorithm also gives the highest entropy value (7.9993 for “Lena” image, 7.9994 for “Airplane” image, and 7.9993 for “Baboon” image). In [44], the nearest value of the entropy 7.9992 has been obtained, but chaotic sequences are used and the algorithm used to obtain these sequences is too complex. In terms of NPCR and UACIA, the values are very close in all cases. According to the results, the proposed method provides better performance than the method based on CNT proposed in [33] in terms of correlation, NPCR, and UACI. Table 13 presents the comparison results in medical images. It comes from Table 13 that the proposed method provides better performance than the method based on CNT proposed in [32]. The single difference is in “OT-MONO2-8-colon” image, where the vertical correlation value (−0.0003) in [32] is higher than ours (−2,33e−03). It comes from this table that the proposed method has a performance similar to that achieved by other recently proposed techniques. The advantages of the proposed method are the originality, the simplicity of algorithm, the efficiency, and the lower number of the round. We use five rounds instead of sixteen as in [28].Table 13
Comparison of results on medical images.
ImagesReferencesVert. corHor. corDiag. corEntropyNPCRUACICT-MONO2-8-abdo[32]−0.00560.0132−0.00067.9856 < e < 7.999299.607733.4501Proposed scheme−2.57e−03−3.56e−03−2.56e−047.999299.61733.4636OT-MONO2-8-colon[32]−0.00030.0012−0.00877.9856 < e < 7.999299.608233.462Proposed scheme−2.33e−035.95e−04−4.25e−047.999399.612433.498


## 5. Conclusion

In this work, a new image encryption algorithm has been proposed in order to secure images during transmission. The cryptosystem uses affine transformations (reflections and rotations), an external secret key of 128 bits long, and an internal secret key coming from the decomposition of the plain image, zigzag process, and substitution-diffusion processes. The particularity of this algorithm is the method to extract the internal secret keys, the use of reflection and rotation mappings on the binary images obtained from the decomposition of the plain image to be encrypted, and the zigzag process not on the gray-scale image but on the binary image and binary block, and finally the method used to combine external and internal keys to generate substitution-diffusion sequences without complex mathematical functions or complex chaotic generators. The size of an internal secret key depends on the size of the original image. The substitution process is also taken in two steps. We have evaluated the proposed algorithm on statistical analysis and key sensitivity analysis. The new proposed system is efficient and robust. The main features of the encryption scheme are its simplicity, its efficiency, and a high security order. Our method also has better confusion, diffusion, and security compared to recent methods in the literature. The combination of external and internal secret keys, the changing of the substitution-diffusion key for one subblock to another, makes the method to be robust against brute-force attacks. The newly proposed method is expected to be useful for real-time encryption and transmission of images in many domains such as telemedicine.



---

*Source: 3865820-2022-01-07.xml*