# An Improved Secure Image Encryption Algorithm Based on Rubik's Cube Principle and Digital Chaotic Cipher

Authors: Adrian-Viorel Diaconu; Khaled Loukhaoukha
Journal: Mathematical Problems in Engineering
 (2013)

---

## Abstract

A recently proposed secure image encryption scheme has drawn attention to the limited security offered by chaos-based image encryption schemes (mainly due to their relatively small key space) proposing a highly robust approach, based on Rubik's cube principle. This paper aims to study a newly designed image cryptosystem that uses the Rubik's cube principle in conjunction with a digital chaotic cipher. Thus, the original image is shuffled on Rubik's cube principle (due to its proven confusion properties), and then XOR operator is applied to rows and columns of the scrambled image using a chaos-based cipher (due to its proven diffusion properties). Finally, the experimental results and security analysis show that the newly proposed image encryption scheme not only can achieve good encryption and perfect hiding ability but also can resist any cryptanalytic attacks (e.g., exhaustive attack, differential attack, statistical attack, etc.).


---

## Body

## 1. Introduction

In secure communication, image encryption schemes transform clear images into unintelligible others. The fundamental techniques used to encrypt a block of pixels are substitution and permutation.Recent years’ battle focuses on designing of highly robust encryption schemes (i.e., which provide good confusion and diffusion properties, to ensure coveted security factor), either using peculiar pixel shuffling methods [1–4], or using innovative digital chaos-based ciphers [5–25], or by making justified compositions between these different pixel shuffling and ciphering techniques [26, 27].In this paper, we take advantage of results enforced in our past research articles [1, 28] (i.e., with images encryption schemes and chaotic ciphers generation), in order to design and analyze a new secure image encryption algorithm (based, in principle, on classic permutation-substitution architecture).The rest of this paper is organized as follows. Section2 presents the design of image cryptosystem (based on Rubik’s cube principle and chaotic cipher). Section 3 makes detailed and comprehensive security assessments on the proposed scheme, while presenting experimental results. Finally, Section 4 concludes the work carried out.


## 2. Modified Rubik’s Cube Image Encryption Algorithm

As the title suggests, this work is based on a previous work about images encryption algorithm, which at its turn is founded on Rubik’s cube principle [1], but with slightly different approaches:(1)
on pixels’ shuffling procedure:
(a)
rows and columns are alternatively shuffled (i.e., a row followed by a column, at a time),(b)
each row’s and column’s circular-shifting direction and number of steps is derived from their intrinsic properties, using different modulo operators;(2)
on pixels’ ciphering procedure:
(a)
maintaining the rule of alternating rows and columns, the shuffled image is doubly ciphered, using two different ciphering matrices,(b)
ciphering matrices are built using bitstreams generated by chaotic systems, in conjunction with a multilevel discretization method [28].In the following three subsections, we will describe the new modified encryption procedure.


### 2.1. Encryption Algorithm

WithI0 representing the pixels values matrix of an 8-bit gray level scale image of the size m×m, the steps of newly proposed encryption algorithm are as follows.(1)
Randomly generateαmax, number of iterations, and β1, β2, rows’ and columns’ modulo operators; initialize α to zero.(2)
Fori=1:m,
(a)
compute the sum of all elements in rowi(1)Srow_i=∑j=1mI0(i,j),(b)
compute moduloβ1 of Srow_i(2)Mrow_i=Srow_i(modβ1),(c)
compute modulo 2 ofMrow_i(3)ωrow_i=Mrow_i(mod2),(d)
ifωrow_i=0→rowi is right circular-shifted, with Mrow_i steps; else, if ωrow_i=1→rowi is left circular-shifted, with Mrow_i steps(e)
compute the sum of all elements in columni(4)Scol_i=∑j=1mI0(j,i),(f)
compute moduloβ2 of Scol_i(5)Mcol_i=Scol_i(modβ2),(g)
compute modulo 2 ofMcol_i(6)ωcol_i=Mcol_i(mod2),(h)
ifωcol_i=0→ column i is up circular shifted, with Mcol_i steps; else, if ωcol_i=1→ column i is down circular shifted, with Mcol_i steps.(3)
Incrementα; if α≤αmax, go to the previous step; else, go to the next step.Steps (2)-(3) will modify matrixI0, generating a newly one denoted as IHVPS (i.e., with horizontal and vertical pixels shuffled).(4)
Compute ciphering matricesIcipher_col and Icipher_row(5)
Fori=1:m,
(a)
cipher rowi(7)IHVPS(i,:)=IHVPS(i,:)⊕Icipher_row(i,:),(b)
cipher columni(8)IHVPS(:,i)=IHVPS(:,i)⊕Icipher_col(i,:)′.Step (5) will modify the matrixIHVPS, generating a newly one denoted as IENC (i.e., representing the pixels values matrix of the encrypted image).


### 2.2. Decryption Algorithm

WithIENC representing the pixels values matrix of an 8-bit gray level scale encrypted image of size m×m, with the correct key K=(α,β1,β2,x,r), the original image I0 is recovered as follows.(1)
Compute ciphering matricesIcipher_col and Icipher_row(2)
Fori=1:m,
(a)
decipher rowi(9)IENC(i,:)=IENC(i,:)⊕Icipher_row(i,:),(b)
decipher columni(10)IENC(:,i)=IENC(:,i)⊕Icipher_col(i,:)′.Step (2) will modify matrixIENC, generating a newly one denoted as IDEC (i.e., representing the pixels values matrix of the deciphered image).
(3)
Initializeα to zero.
(4)
Fori=1:m,
(a)
compute the sum of all elements in columni(11)Scol_i=∑j=1mIDEC(j,(m+1-i)),
(b)
compute moduloβ2 of Scol_i(12)Mcol_i=Scol_i(modβ2),
(c)
compute modulo 2 ofMcol_i(13)ωcol_i=Mcol_i(mod2),
(d)
ifωcol_i=1→ column i is up circular shifted, with Mcol_i steps; else, if ωcol_i=0→ column i is down circular shifted, with Mcol_i steps,
(e)
compute the sum of all elements in rowi(14)Srow_i=∑j=1mIDEC((m+1-i),j),
(f)
compute moduloβ1 of Srow_i(15)Mrow_i=Srow_i(modβ1),
(g)
compute modulo 2 ofMrow_i(16)ωrow_i=Mrow_i(mod2),
(h)
ifωrow_i=1→rowi is right circular shifted, with Mrow_i steps; else, if ωrow_i= 0→rowi is left circular shifted, with Mrow_i steps.
(5)
Incrementα; if α≤αmax, go to the previous step; else, the decryption process is done.
Steps (4)-(5) will modify the matrixIDEC, generating a new one denoted as I0 (i.e., representing the pixels values matrix of the deshuffled image ~ the original image).


### 2.3. Ciphering Matrices Computation

Given any chaotic map (e.g., a tent map (17), denoted as fT), using random sequences of real numbers generated by its orbits in conjunction with a multilevel discretization method [28] (e.g., with four thresholds, i.e., 2-bit encoding of each interval), resulted di-bits are spread into two separate files (i.e., “Bits_A.txt,” containing di-bit’s first bit; resp., “Bits_B.txt,” containing di-bit’s second bit). Consider
(17)fT:[0,1]→[0,1],fT(x)=r(1-|1-2x|),r∈(0,1)m·m·8 di-bit pairs have been generated (i.e., 2.097.152 bits were written in each file), this number being, as seen, directly proportional to the image dimensions.f
T’s initial seeding points were r=1.99831378796143 and x=0.687754925117697.Under the previous circumstances, ciphering matrices are computed as follows.(1)
Open and read “Bits_A.txt” and “Bits_B.txt” files; initialize a temporary counter C to zero.(2)
InitializeIcipher_col and Icipher_row, where
(18)Icipher_col=Icipher_row=zeros(m,m).(3)
Fori=1:m, for j=1:m,
(a)
take eight consecutive bits from each file(19)Byte_A=strcat(Bits_A.txt(C+k)),k=1,8¯,Byte_B=strcat(Bits_B.txt(C+k)),k=1,8¯;(b)
updateIcipher_col and Icipher_row(20)Icipher_row(i,j)=bin2dec(Byte_A),Icipher_col(i,j)=bin2dec(Byte_B);(c)
update the temporary counter(21)C=C+8.Steps (1)–(3) will produce the ciphering matrices.


## 2.1. Encryption Algorithm

WithI0 representing the pixels values matrix of an 8-bit gray level scale image of the size m×m, the steps of newly proposed encryption algorithm are as follows.(1)
Randomly generateαmax, number of iterations, and β1, β2, rows’ and columns’ modulo operators; initialize α to zero.(2)
Fori=1:m,
(a)
compute the sum of all elements in rowi(1)Srow_i=∑j=1mI0(i,j),(b)
compute moduloβ1 of Srow_i(2)Mrow_i=Srow_i(modβ1),(c)
compute modulo 2 ofMrow_i(3)ωrow_i=Mrow_i(mod2),(d)
ifωrow_i=0→rowi is right circular-shifted, with Mrow_i steps; else, if ωrow_i=1→rowi is left circular-shifted, with Mrow_i steps(e)
compute the sum of all elements in columni(4)Scol_i=∑j=1mI0(j,i),(f)
compute moduloβ2 of Scol_i(5)Mcol_i=Scol_i(modβ2),(g)
compute modulo 2 ofMcol_i(6)ωcol_i=Mcol_i(mod2),(h)
ifωcol_i=0→ column i is up circular shifted, with Mcol_i steps; else, if ωcol_i=1→ column i is down circular shifted, with Mcol_i steps.(3)
Incrementα; if α≤αmax, go to the previous step; else, go to the next step.Steps (2)-(3) will modify matrixI0, generating a newly one denoted as IHVPS (i.e., with horizontal and vertical pixels shuffled).(4)
Compute ciphering matricesIcipher_col and Icipher_row(5)
Fori=1:m,
(a)
cipher rowi(7)IHVPS(i,:)=IHVPS(i,:)⊕Icipher_row(i,:),(b)
cipher columni(8)IHVPS(:,i)=IHVPS(:,i)⊕Icipher_col(i,:)′.Step (5) will modify the matrixIHVPS, generating a newly one denoted as IENC (i.e., representing the pixels values matrix of the encrypted image).


## 2.2. Decryption Algorithm

WithIENC representing the pixels values matrix of an 8-bit gray level scale encrypted image of size m×m, with the correct key K=(α,β1,β2,x,r), the original image I0 is recovered as follows.(1)
Compute ciphering matricesIcipher_col and Icipher_row(2)
Fori=1:m,
(a)
decipher rowi(9)IENC(i,:)=IENC(i,:)⊕Icipher_row(i,:),(b)
decipher columni(10)IENC(:,i)=IENC(:,i)⊕Icipher_col(i,:)′.Step (2) will modify matrixIENC, generating a newly one denoted as IDEC (i.e., representing the pixels values matrix of the deciphered image).
(3)
Initializeα to zero.
(4)
Fori=1:m,
(a)
compute the sum of all elements in columni(11)Scol_i=∑j=1mIDEC(j,(m+1-i)),
(b)
compute moduloβ2 of Scol_i(12)Mcol_i=Scol_i(modβ2),
(c)
compute modulo 2 ofMcol_i(13)ωcol_i=Mcol_i(mod2),
(d)
ifωcol_i=1→ column i is up circular shifted, with Mcol_i steps; else, if ωcol_i=0→ column i is down circular shifted, with Mcol_i steps,
(e)
compute the sum of all elements in rowi(14)Srow_i=∑j=1mIDEC((m+1-i),j),
(f)
compute moduloβ1 of Srow_i(15)Mrow_i=Srow_i(modβ1),
(g)
compute modulo 2 ofMrow_i(16)ωrow_i=Mrow_i(mod2),
(h)
ifωrow_i=1→rowi is right circular shifted, with Mrow_i steps; else, if ωrow_i= 0→rowi is left circular shifted, with Mrow_i steps.
(5)
Incrementα; if α≤αmax, go to the previous step; else, the decryption process is done.
Steps (4)-(5) will modify the matrixIDEC, generating a new one denoted as I0 (i.e., representing the pixels values matrix of the deshuffled image ~ the original image).


## 2.3. Ciphering Matrices Computation

Given any chaotic map (e.g., a tent map (17), denoted as fT), using random sequences of real numbers generated by its orbits in conjunction with a multilevel discretization method [28] (e.g., with four thresholds, i.e., 2-bit encoding of each interval), resulted di-bits are spread into two separate files (i.e., “Bits_A.txt,” containing di-bit’s first bit; resp., “Bits_B.txt,” containing di-bit’s second bit). Consider
(17)fT:[0,1]→[0,1],fT(x)=r(1-|1-2x|),r∈(0,1)m·m·8 di-bit pairs have been generated (i.e., 2.097.152 bits were written in each file), this number being, as seen, directly proportional to the image dimensions.f
T’s initial seeding points were r=1.99831378796143 and x=0.687754925117697.Under the previous circumstances, ciphering matrices are computed as follows.(1)
Open and read “Bits_A.txt” and “Bits_B.txt” files; initialize a temporary counter C to zero.(2)
InitializeIcipher_col and Icipher_row, where
(18)Icipher_col=Icipher_row=zeros(m,m).(3)
Fori=1:m, for j=1:m,
(a)
take eight consecutive bits from each file(19)Byte_A=strcat(Bits_A.txt(C+k)),k=1,8¯,Byte_B=strcat(Bits_B.txt(C+k)),k=1,8¯;(b)
updateIcipher_col and Icipher_row(20)Icipher_row(i,j)=bin2dec(Byte_A),Icipher_col(i,j)=bin2dec(Byte_B);(c)
update the temporary counter(21)C=C+8.Steps (1)–(3) will produce the ciphering matrices.


## 3. Experimental Results

In order to assess the efficiency and security of the newly resulted image encryption algorithm, various analyses were conducted (e.g., statistical, strength against some cryptographic attacks, etc.). This section deals with the presentation of tests and observations over the results achieved (performances).


### 3.1. Visual Testing

The purpose of visual testing is to highlight presence of similarities between plain-image and shuffled and (or) ciphered image (i.e., if the scrambled and (or) ciphered image does or does not contain any features of the plain-image).Visual testing was performed on the512×512 pixels, 8-bit, gray-level, Lena standard test image. Figure 1 depicts the test image (a), along with its shuffled (b) and ciphered (c) versions. By comparing them, one can say that there is no perceptual similarity (i.e., no visual information can be observed in processed versions of plain-image).Original, shuffled, and encrypted images. (a) Original image, (b) shuffled image and (c) encrypted image. (Test conditions:α=10, β1=167, β2=202, r=1.998313787961430, and x=0.687754925117697.)
(a)
(b)
(c)


### 3.2. Security Assessment by Statistical Analysis

The main two statistical analyses, generally performed when it comes to showcase confusion and diffusion properties of an image shuffling and (or) ciphering algorithm, are the histograms analysis and analysis of the correlation coefficient between adjacent pixels. [1, 2, 5–8, 26].


#### 3.2.1. Histogram Analysis

Histogram analysis depicts pixels’ distribution within an image, by representing their number relative to each intensity level. Figure2 represents histograms of original (a), shuffled (b), and ciphered (c) images. As expected, although a superior diffusion effect is achieved through pixels’ shuffling procedure, image histogram is not modified thus making it vulnerable to statistical attacks. But after algorithm’s second phase (i.e., ciphering procedure) completion, the histogram gains a uniform distribution, meaningfully different than the one of original image (which contains large sharp rises followed by sharp declines), and thus with no statistical similarity in appearance, resulted image does not provide any clue for statistical attacks.Histograms of original, shuffled, and encrypted images. (a) Histogram of original image, (b) histogram of shuffled image, and (c) histogram of encrypted image. (Test conditions:α=10, β1=167, β2=202, r=1.998313787961430, and x=0.687754925117697.)
(a)
(b)
(c)


#### 3.2.2. Adjacent Pixels Correlation Coefficients

It is well known that, generally in plain-images, any arbitrarily chosen pixel is strongly correlated with its adjacent pixels (either they are diagonally, vertically, or horizontally oriented) [3, 9]. Figure 3 shows the correlation distributions of the horizontal adjacent pixels for the original (a), shuffled (b), and encrypted images (c), while the correlation distributions of the vertically and diagonally adjacent pixels are shown in Figure 4, respectively, Figure 5. At the same time, all the correlation coefficient values (computed over 10.000 pairs of adjacent pixels, randomly selected, for each of the testing directions) are summarized in Table 1. It can be easily noticed that neighboring pixels in the original image are highly correlated; that is, correlation coefficient values are too high, very close to one. In contrary, in cases of shuffled and encrypted images, those values are close to zero, meaning that all neighboring pixels considered in tests are weakly correlated, which is the expected result [4, 10–12, 29].Table 1
Correlation coefficients of adjacent pairs of pixels.
Image
Adjacent pixels orientation
Vertical
Horizontal
Diagonal
Original
0.9696
0.9820
0.9577
Shuffled
0.0019
0.0090
0.0104
Encrypted
0.0002
0.0006
0.0043Correlation distribution of horizontally adjacent pixels. (a) Original image, (b) shuffled image, and (c) encrypted image. (Test conditions:α=10, β1=167, β2=202, r=1.998313787961430, and x=0.687754925117697.)
(a)
(b)
(c)Correlation distribution of vertically adjacent pixels. (a) Original image, (b) shuffled image, and (c) encrypted image. (Test conditions:α=10, β1=167, β2=202, r=1.998313787961430, and x=0.687754925117697.)
(a)
(b)
(c)Correlation distribution of diagonally adjacent pixels. (a) Original image, (b) shuffled image, and (c) encrypted image. (Test conditions:α=10, β1=167, β2=202, r=1.998313787961430, and x=0.687754925117697.)
(a)
(b)
(c)Overall, results are with an order of better magnitude, compared with results of other proposed algorithms, as proven in [13–16].


### 3.3. Security Assessment by Differential Analysis

Differential cryptanalysis assumes that the attacker is able to create small changes in the input plain-image and examine outputs (i.e., original image’s processed versions). In doing this, shuffling and (or) encryption key(s) and (or) the meaningful relationship between original images and its shuffled or encrypted versions can be derived. Therefore, a desirable property of the proposed modified algorithm is to be sensitive to the small changes in plain-image. Thus, the differential attack can actually lose its efficiency and become practically useless, if one small change in the original image can cause a significant change in its processed versions.Security assessment by differential analysis is based on three measures: NPCR (number of pixels change rate), UACI (unified average changing intensity), and MAE (i.e., mean absolute error). In order to approach the performances of ideal image encryption algorithms, MAE and NPCR must be as large as possible (i.e., close to unity, at least for NPCR), while UACI values must be around 33% [1, 2, 5, 7].NPCR, UACI, and MAE values, summarized in Table2, demonstrate that swiftly changes in the original image will result in negligible changes in its shuffled and encrypted versions and also that choosing higher values of α, β1, and β2 will result in higher values of these coefficients, thus a better strength against any differential cryptanalysis.Table 2
Difference measures between original and shuffled or encrypted images.
Image
NPCR[%]
UACI[%]
MAE[%]
Test conditions
α
β
1
β
2
Shuffled
≪80
≪5
≪10
0 <β1< 10
0 <β2 < 10
97.7104
13.3053
33.9286
10
≤
⋯
≤
10
2
10
≤
⋯
≤
10
2
99.2668
22.7348
57.9737
1
10
2
<
⋯
≤
10
3
10
2
<
⋯
≤
10
3
99.3950
23.4347
59.7585
10
3
<
⋯
≤
10
4
10
3
<
⋯
≤
10
4
99.4068
23.4454
59.7858
10
4
<
⋯
≤
10
5
10
4
<
⋯
≤
10
5
99.4476
23.7236
60.4951
10
<
α
≤
10
2
10
2
<
⋯
≤
10
3
10
2
<
⋯
≤
10
3
99.4541
23.7657
60.6026
10
2
<
⋯
≤
10
3
99.4629
23.7697
60.7253
10
3
<
⋯
≤
10
4
99.4673
23.7701
60.7284
10
4
<
⋯
≤
10
5
99.6078
30.5903
78.0053
1
10
2
<
⋯
≤
10
3
10
2
<
⋯
≤
10
3
Encrypted
99.6090
30.5699
77.9533
10
<
α
≤
10
2
99.6120
30.5997
78.0292
10
2
<
⋯
≤
10
3Overall, results are, on average, about1.29%–28.09% (in case of UACI), 62.61%–78.11% (in case of NPCR), and over 42.89% (in case of MAE) better, compared with results of other proposed algorithms [13–16] for the following test conditions: α, β1, β2∈[102,103]. Similar results, especially in terms of NPCR’s value, are proven in [1, 5].


### 3.4. Security Assessment by Entropy Analysis

An algorithm for encryption of images should give a ciphered image having equiprobable gray levels (i.e., the entropy of this ciphered image should be, at least theoretically, equal to 8 bits, for gray-scale images of 256 levels). Actually, in practice, the resulted entropy is smaller than the ideal one. The smaller the resulted entropy, the greater the degree of predictability, a fact which threatens encryption system’s security.Computing the entropy value of the encrypted image, which is very close to the ideal value of 8 Sh (more accurately 7.9992 Sh, much more closer than values resulted under different algorithms [21–23, 30]), we can say that the proposed encryption algorithm is highly robust against entropy attacks.


### 3.5. Security Assessment by Key Analysis

This security assessment targets the key space and sensibility.


#### 3.5.1. Key Sensibility

In order to approach the performances of an ideal image encryption algorithm, the proposed one should have high sensibility to encryption key (i.e., any small change in the key should lead to a significant change in the shuffled and encrypted or deshuffled and decrypted images).For the newly proposed scheme the encryption key isK=(α,β1,β2,x,r). Various tests were performed in order to highlight the impact of key changes in the image deshuffling and decryption processes. Results are presented in Figures 6, 7, and 8. Clearly, deshuffling and (or) decryption using wrong key does not succeed.Algorithm key sensibility image deshuffled using (a) wrong keyβ1 (+1 LSB variation), (b) wrong key β2 (−1 LSB variation), (c) wrong keys β1,β2 (±1 LSB variations). (Test conditions: image successfully decrypted; r=1.998313787961430, x=0.687754925117697, and α=10 known.)
(a)
(b)
(c)Algorithm key sensibility image deshuffled using (a) wrong number of iterations (α+1  LSB variation) and (b) wrong number of iterations (α-1 LSB variation). (Test conditions: image successfully decrypted; r=1.998313787961430, x=0.687754925117697, β1=167, & β2=202 known.)
(a)
(b)Algorithm key sensibility image decrypted using (a) wrong keyx (±1·10-15 variations), (b) wrong key r (±1·10-15 variations), and (c) wrong keys x and r (±1·10-15 variations).
(a)
(b)
(c)


#### 3.5.2. Key Space

A large key space is very important for an encryption algorithm to repel the brute-force attack. In theory, the proposed scheme can accommodate an infinite key space, taking into accountα, β1, and β2; but, due to actual computational limitations, α, β1, and β2 key elements are restrained to 64-bit representation, and, at first sight, the key space size is 2192. Furthermore, the two seed points of the chaotic generator (viz., x and r), with 10-15 precision, extend the key space by 1030. Therefore, a total 1088 key space is large enough to face an exhaustive attack [6, 17–20, 27].


### 3.6. Security Assessment by Different Attacks

Few attacks, such as cropping and additive noise, can be performed by an attacker who intercepts encrypted image, in order to modify it so that, after decryption, the legitimate user cannot understand and (or) use the original message (i.e., in our case, the image).The following two subsections aim to analyze proposed scheme’s performances against such attacks.


#### 3.6.1. Additive Noise Attack

An additive noise attack consists in adding random noise to the intercepted encrypted image. Two types of noises are considered: salt and pepper noise and speckle noise. To measure robustness of the proposed image encryption scheme against these attacks, MSE measure is used.Figures9 and 10 illustrate decrypted images, in cases where their encrypted version was attacked by salt and pepper noise with 0.0001 densities (a) and by speckle noise with 0.0001 variance (b), but under different test conditions.Decrypted images (a) under salt and pepper noise attack, (b) under speckle noise attack, and (c) under cropping attack. (Test conditions:α=3, β1=10, and β2=10.)
(a)
(b)
(c)Decrypted images (a) under salt and pepper noise attack, (b) under speckle noise attack, and (c) under cropping attack. (Test conditions:α=125, β1=107, and β2=202.)
(a)
(b)
(c)As expected, due to the fact that each column’s and row’s intrinsic properties were used to compute the number of their circular shifts, the proposed image encryption scheme has no immunity to this kind of attacks, statement strengthened by MSE measure’s values (2.515 · 103 in Figure 9(a) and 2.372 · 103 in Figure 9(b), resp., 5.599 · 103 in Figure 10(a) and 5.697 · 103 in Figure 10(b)).


#### 3.6.2. Cropping Attacks

Cropping attacks consist of modifying the intercepted encrypted image by deleting one, or several of its areas. To measure robustness of proposed encryption scheme against this kind of attacks, MSE measure is used also.Figures9 and 10 illustrate decrypted image, in cases where their encrypted version was attacked by cropping one 1/8 of its area (c).Same problem is raised by the shuffling procedure mode of operation, and proposed image encryption scheme cannot handle such type of attacks, statement strengthened by MSE measure’s values (3.031 · 103 in Figure 9(c) and 6.043 · 103 in Figure 10(c)).From the previous results, we can conclude that random noise attacks, seriously affect decrypted images. As a proposal, if it is known that the proposed encryption scheme will be used within a communication system susceptible to perturbations, algorithms (or systems) to ensure data integrity should be used, as the one shown in [31].


### 3.7. Speed Test

Another important matter taken into account when new image encryption techniques are proposed is the actual algorithm execution speed.Regardless ofβ1 and β2 variations, shuffling time is of 0.2158 s while the deshuffling time is of 0.1987 s. Obviously, these timings are increasing proportionally with α number of iterations. With an actual ciphering time of 0.1826 s and a deciphering time of 0.1701 s, proposed scheme’s encryption and decryption speeds are smaller than 0.40 s (more accurately, 0.3984 s and 0.3688 s). Achieved speed is superior, in comparison with those of other algorithms [1, 5, 13–16].The speed test was performed on the512×512 pixels, 8-bit, gray-level, Lena standard test image.All the previous results (i.e., numerical results presented in the entire Section3) were generated with proposed encryption algorithm’s scripts for (de)shuffling and (de)ciphering written on MATLAB 7.3.0 and ran on an Intel Pentium Dual CPU T3200 @ 2.00 GHz personal computer.


## 3.1. Visual Testing

The purpose of visual testing is to highlight presence of similarities between plain-image and shuffled and (or) ciphered image (i.e., if the scrambled and (or) ciphered image does or does not contain any features of the plain-image).Visual testing was performed on the512×512 pixels, 8-bit, gray-level, Lena standard test image. Figure 1 depicts the test image (a), along with its shuffled (b) and ciphered (c) versions. By comparing them, one can say that there is no perceptual similarity (i.e., no visual information can be observed in processed versions of plain-image).Original, shuffled, and encrypted images. (a) Original image, (b) shuffled image and (c) encrypted image. (Test conditions:α=10, β1=167, β2=202, r=1.998313787961430, and x=0.687754925117697.)
(a)
(b)
(c)


## 3.2. Security Assessment by Statistical Analysis

The main two statistical analyses, generally performed when it comes to showcase confusion and diffusion properties of an image shuffling and (or) ciphering algorithm, are the histograms analysis and analysis of the correlation coefficient between adjacent pixels. [1, 2, 5–8, 26].


### 3.2.1. Histogram Analysis

Histogram analysis depicts pixels’ distribution within an image, by representing their number relative to each intensity level. Figure2 represents histograms of original (a), shuffled (b), and ciphered (c) images. As expected, although a superior diffusion effect is achieved through pixels’ shuffling procedure, image histogram is not modified thus making it vulnerable to statistical attacks. But after algorithm’s second phase (i.e., ciphering procedure) completion, the histogram gains a uniform distribution, meaningfully different than the one of original image (which contains large sharp rises followed by sharp declines), and thus with no statistical similarity in appearance, resulted image does not provide any clue for statistical attacks.Histograms of original, shuffled, and encrypted images. (a) Histogram of original image, (b) histogram of shuffled image, and (c) histogram of encrypted image. (Test conditions:α=10, β1=167, β2=202, r=1.998313787961430, and x=0.687754925117697.)
(a)
(b)
(c)


### 3.2.2. Adjacent Pixels Correlation Coefficients

It is well known that, generally in plain-images, any arbitrarily chosen pixel is strongly correlated with its adjacent pixels (either they are diagonally, vertically, or horizontally oriented) [3, 9]. Figure 3 shows the correlation distributions of the horizontal adjacent pixels for the original (a), shuffled (b), and encrypted images (c), while the correlation distributions of the vertically and diagonally adjacent pixels are shown in Figure 4, respectively, Figure 5. At the same time, all the correlation coefficient values (computed over 10.000 pairs of adjacent pixels, randomly selected, for each of the testing directions) are summarized in Table 1. It can be easily noticed that neighboring pixels in the original image are highly correlated; that is, correlation coefficient values are too high, very close to one. In contrary, in cases of shuffled and encrypted images, those values are close to zero, meaning that all neighboring pixels considered in tests are weakly correlated, which is the expected result [4, 10–12, 29].Table 1
Correlation coefficients of adjacent pairs of pixels.
Image
Adjacent pixels orientation
Vertical
Horizontal
Diagonal
Original
0.9696
0.9820
0.9577
Shuffled
0.0019
0.0090
0.0104
Encrypted
0.0002
0.0006
0.0043Correlation distribution of horizontally adjacent pixels. (a) Original image, (b) shuffled image, and (c) encrypted image. (Test conditions:α=10, β1=167, β2=202, r=1.998313787961430, and x=0.687754925117697.)
(a)
(b)
(c)Correlation distribution of vertically adjacent pixels. (a) Original image, (b) shuffled image, and (c) encrypted image. (Test conditions:α=10, β1=167, β2=202, r=1.998313787961430, and x=0.687754925117697.)
(a)
(b)
(c)Correlation distribution of diagonally adjacent pixels. (a) Original image, (b) shuffled image, and (c) encrypted image. (Test conditions:α=10, β1=167, β2=202, r=1.998313787961430, and x=0.687754925117697.)
(a)
(b)
(c)Overall, results are with an order of better magnitude, compared with results of other proposed algorithms, as proven in [13–16].


## 3.2.1. Histogram Analysis

Histogram analysis depicts pixels’ distribution within an image, by representing their number relative to each intensity level. Figure2 represents histograms of original (a), shuffled (b), and ciphered (c) images. As expected, although a superior diffusion effect is achieved through pixels’ shuffling procedure, image histogram is not modified thus making it vulnerable to statistical attacks. But after algorithm’s second phase (i.e., ciphering procedure) completion, the histogram gains a uniform distribution, meaningfully different than the one of original image (which contains large sharp rises followed by sharp declines), and thus with no statistical similarity in appearance, resulted image does not provide any clue for statistical attacks.Histograms of original, shuffled, and encrypted images. (a) Histogram of original image, (b) histogram of shuffled image, and (c) histogram of encrypted image. (Test conditions:α=10, β1=167, β2=202, r=1.998313787961430, and x=0.687754925117697.)
(a)
(b)
(c)


## 3.2.2. Adjacent Pixels Correlation Coefficients

It is well known that, generally in plain-images, any arbitrarily chosen pixel is strongly correlated with its adjacent pixels (either they are diagonally, vertically, or horizontally oriented) [3, 9]. Figure 3 shows the correlation distributions of the horizontal adjacent pixels for the original (a), shuffled (b), and encrypted images (c), while the correlation distributions of the vertically and diagonally adjacent pixels are shown in Figure 4, respectively, Figure 5. At the same time, all the correlation coefficient values (computed over 10.000 pairs of adjacent pixels, randomly selected, for each of the testing directions) are summarized in Table 1. It can be easily noticed that neighboring pixels in the original image are highly correlated; that is, correlation coefficient values are too high, very close to one. In contrary, in cases of shuffled and encrypted images, those values are close to zero, meaning that all neighboring pixels considered in tests are weakly correlated, which is the expected result [4, 10–12, 29].Table 1
Correlation coefficients of adjacent pairs of pixels.
Image
Adjacent pixels orientation
Vertical
Horizontal
Diagonal
Original
0.9696
0.9820
0.9577
Shuffled
0.0019
0.0090
0.0104
Encrypted
0.0002
0.0006
0.0043Correlation distribution of horizontally adjacent pixels. (a) Original image, (b) shuffled image, and (c) encrypted image. (Test conditions:α=10, β1=167, β2=202, r=1.998313787961430, and x=0.687754925117697.)
(a)
(b)
(c)Correlation distribution of vertically adjacent pixels. (a) Original image, (b) shuffled image, and (c) encrypted image. (Test conditions:α=10, β1=167, β2=202, r=1.998313787961430, and x=0.687754925117697.)
(a)
(b)
(c)Correlation distribution of diagonally adjacent pixels. (a) Original image, (b) shuffled image, and (c) encrypted image. (Test conditions:α=10, β1=167, β2=202, r=1.998313787961430, and x=0.687754925117697.)
(a)
(b)
(c)Overall, results are with an order of better magnitude, compared with results of other proposed algorithms, as proven in [13–16].


## 3.3. Security Assessment by Differential Analysis

Differential cryptanalysis assumes that the attacker is able to create small changes in the input plain-image and examine outputs (i.e., original image’s processed versions). In doing this, shuffling and (or) encryption key(s) and (or) the meaningful relationship between original images and its shuffled or encrypted versions can be derived. Therefore, a desirable property of the proposed modified algorithm is to be sensitive to the small changes in plain-image. Thus, the differential attack can actually lose its efficiency and become practically useless, if one small change in the original image can cause a significant change in its processed versions.Security assessment by differential analysis is based on three measures: NPCR (number of pixels change rate), UACI (unified average changing intensity), and MAE (i.e., mean absolute error). In order to approach the performances of ideal image encryption algorithms, MAE and NPCR must be as large as possible (i.e., close to unity, at least for NPCR), while UACI values must be around 33% [1, 2, 5, 7].NPCR, UACI, and MAE values, summarized in Table2, demonstrate that swiftly changes in the original image will result in negligible changes in its shuffled and encrypted versions and also that choosing higher values of α, β1, and β2 will result in higher values of these coefficients, thus a better strength against any differential cryptanalysis.Table 2
Difference measures between original and shuffled or encrypted images.
Image
NPCR[%]
UACI[%]
MAE[%]
Test conditions
α
β
1
β
2
Shuffled
≪80
≪5
≪10
0 <β1< 10
0 <β2 < 10
97.7104
13.3053
33.9286
10
≤
⋯
≤
10
2
10
≤
⋯
≤
10
2
99.2668
22.7348
57.9737
1
10
2
<
⋯
≤
10
3
10
2
<
⋯
≤
10
3
99.3950
23.4347
59.7585
10
3
<
⋯
≤
10
4
10
3
<
⋯
≤
10
4
99.4068
23.4454
59.7858
10
4
<
⋯
≤
10
5
10
4
<
⋯
≤
10
5
99.4476
23.7236
60.4951
10
<
α
≤
10
2
10
2
<
⋯
≤
10
3
10
2
<
⋯
≤
10
3
99.4541
23.7657
60.6026
10
2
<
⋯
≤
10
3
99.4629
23.7697
60.7253
10
3
<
⋯
≤
10
4
99.4673
23.7701
60.7284
10
4
<
⋯
≤
10
5
99.6078
30.5903
78.0053
1
10
2
<
⋯
≤
10
3
10
2
<
⋯
≤
10
3
Encrypted
99.6090
30.5699
77.9533
10
<
α
≤
10
2
99.6120
30.5997
78.0292
10
2
<
⋯
≤
10
3Overall, results are, on average, about1.29%–28.09% (in case of UACI), 62.61%–78.11% (in case of NPCR), and over 42.89% (in case of MAE) better, compared with results of other proposed algorithms [13–16] for the following test conditions: α, β1, β2∈[102,103]. Similar results, especially in terms of NPCR’s value, are proven in [1, 5].


## 3.4. Security Assessment by Entropy Analysis

An algorithm for encryption of images should give a ciphered image having equiprobable gray levels (i.e., the entropy of this ciphered image should be, at least theoretically, equal to 8 bits, for gray-scale images of 256 levels). Actually, in practice, the resulted entropy is smaller than the ideal one. The smaller the resulted entropy, the greater the degree of predictability, a fact which threatens encryption system’s security.Computing the entropy value of the encrypted image, which is very close to the ideal value of 8 Sh (more accurately 7.9992 Sh, much more closer than values resulted under different algorithms [21–23, 30]), we can say that the proposed encryption algorithm is highly robust against entropy attacks.


## 3.5. Security Assessment by Key Analysis

This security assessment targets the key space and sensibility.


### 3.5.1. Key Sensibility

In order to approach the performances of an ideal image encryption algorithm, the proposed one should have high sensibility to encryption key (i.e., any small change in the key should lead to a significant change in the shuffled and encrypted or deshuffled and decrypted images).For the newly proposed scheme the encryption key isK=(α,β1,β2,x,r). Various tests were performed in order to highlight the impact of key changes in the image deshuffling and decryption processes. Results are presented in Figures 6, 7, and 8. Clearly, deshuffling and (or) decryption using wrong key does not succeed.Algorithm key sensibility image deshuffled using (a) wrong keyβ1 (+1 LSB variation), (b) wrong key β2 (−1 LSB variation), (c) wrong keys β1,β2 (±1 LSB variations). (Test conditions: image successfully decrypted; r=1.998313787961430, x=0.687754925117697, and α=10 known.)
(a)
(b)
(c)Algorithm key sensibility image deshuffled using (a) wrong number of iterations (α+1  LSB variation) and (b) wrong number of iterations (α-1 LSB variation). (Test conditions: image successfully decrypted; r=1.998313787961430, x=0.687754925117697, β1=167, & β2=202 known.)
(a)
(b)Algorithm key sensibility image decrypted using (a) wrong keyx (±1·10-15 variations), (b) wrong key r (±1·10-15 variations), and (c) wrong keys x and r (±1·10-15 variations).
(a)
(b)
(c)


### 3.5.2. Key Space

A large key space is very important for an encryption algorithm to repel the brute-force attack. In theory, the proposed scheme can accommodate an infinite key space, taking into accountα, β1, and β2; but, due to actual computational limitations, α, β1, and β2 key elements are restrained to 64-bit representation, and, at first sight, the key space size is 2192. Furthermore, the two seed points of the chaotic generator (viz., x and r), with 10-15 precision, extend the key space by 1030. Therefore, a total 1088 key space is large enough to face an exhaustive attack [6, 17–20, 27].


## 3.5.1. Key Sensibility

In order to approach the performances of an ideal image encryption algorithm, the proposed one should have high sensibility to encryption key (i.e., any small change in the key should lead to a significant change in the shuffled and encrypted or deshuffled and decrypted images).For the newly proposed scheme the encryption key isK=(α,β1,β2,x,r). Various tests were performed in order to highlight the impact of key changes in the image deshuffling and decryption processes. Results are presented in Figures 6, 7, and 8. Clearly, deshuffling and (or) decryption using wrong key does not succeed.Algorithm key sensibility image deshuffled using (a) wrong keyβ1 (+1 LSB variation), (b) wrong key β2 (−1 LSB variation), (c) wrong keys β1,β2 (±1 LSB variations). (Test conditions: image successfully decrypted; r=1.998313787961430, x=0.687754925117697, and α=10 known.)
(a)
(b)
(c)Algorithm key sensibility image deshuffled using (a) wrong number of iterations (α+1  LSB variation) and (b) wrong number of iterations (α-1 LSB variation). (Test conditions: image successfully decrypted; r=1.998313787961430, x=0.687754925117697, β1=167, & β2=202 known.)
(a)
(b)Algorithm key sensibility image decrypted using (a) wrong keyx (±1·10-15 variations), (b) wrong key r (±1·10-15 variations), and (c) wrong keys x and r (±1·10-15 variations).
(a)
(b)
(c)


## 3.5.2. Key Space

A large key space is very important for an encryption algorithm to repel the brute-force attack. In theory, the proposed scheme can accommodate an infinite key space, taking into accountα, β1, and β2; but, due to actual computational limitations, α, β1, and β2 key elements are restrained to 64-bit representation, and, at first sight, the key space size is 2192. Furthermore, the two seed points of the chaotic generator (viz., x and r), with 10-15 precision, extend the key space by 1030. Therefore, a total 1088 key space is large enough to face an exhaustive attack [6, 17–20, 27].


## 3.6. Security Assessment by Different Attacks

Few attacks, such as cropping and additive noise, can be performed by an attacker who intercepts encrypted image, in order to modify it so that, after decryption, the legitimate user cannot understand and (or) use the original message (i.e., in our case, the image).The following two subsections aim to analyze proposed scheme’s performances against such attacks.


### 3.6.1. Additive Noise Attack

An additive noise attack consists in adding random noise to the intercepted encrypted image. Two types of noises are considered: salt and pepper noise and speckle noise. To measure robustness of the proposed image encryption scheme against these attacks, MSE measure is used.Figures9 and 10 illustrate decrypted images, in cases where their encrypted version was attacked by salt and pepper noise with 0.0001 densities (a) and by speckle noise with 0.0001 variance (b), but under different test conditions.Decrypted images (a) under salt and pepper noise attack, (b) under speckle noise attack, and (c) under cropping attack. (Test conditions:α=3, β1=10, and β2=10.)
(a)
(b)
(c)Decrypted images (a) under salt and pepper noise attack, (b) under speckle noise attack, and (c) under cropping attack. (Test conditions:α=125, β1=107, and β2=202.)
(a)
(b)
(c)As expected, due to the fact that each column’s and row’s intrinsic properties were used to compute the number of their circular shifts, the proposed image encryption scheme has no immunity to this kind of attacks, statement strengthened by MSE measure’s values (2.515 · 103 in Figure 9(a) and 2.372 · 103 in Figure 9(b), resp., 5.599 · 103 in Figure 10(a) and 5.697 · 103 in Figure 10(b)).


### 3.6.2. Cropping Attacks

Cropping attacks consist of modifying the intercepted encrypted image by deleting one, or several of its areas. To measure robustness of proposed encryption scheme against this kind of attacks, MSE measure is used also.Figures9 and 10 illustrate decrypted image, in cases where their encrypted version was attacked by cropping one 1/8 of its area (c).Same problem is raised by the shuffling procedure mode of operation, and proposed image encryption scheme cannot handle such type of attacks, statement strengthened by MSE measure’s values (3.031 · 103 in Figure 9(c) and 6.043 · 103 in Figure 10(c)).From the previous results, we can conclude that random noise attacks, seriously affect decrypted images. As a proposal, if it is known that the proposed encryption scheme will be used within a communication system susceptible to perturbations, algorithms (or systems) to ensure data integrity should be used, as the one shown in [31].


## 3.6.1. Additive Noise Attack

An additive noise attack consists in adding random noise to the intercepted encrypted image. Two types of noises are considered: salt and pepper noise and speckle noise. To measure robustness of the proposed image encryption scheme against these attacks, MSE measure is used.Figures9 and 10 illustrate decrypted images, in cases where their encrypted version was attacked by salt and pepper noise with 0.0001 densities (a) and by speckle noise with 0.0001 variance (b), but under different test conditions.Decrypted images (a) under salt and pepper noise attack, (b) under speckle noise attack, and (c) under cropping attack. (Test conditions:α=3, β1=10, and β2=10.)
(a)
(b)
(c)Decrypted images (a) under salt and pepper noise attack, (b) under speckle noise attack, and (c) under cropping attack. (Test conditions:α=125, β1=107, and β2=202.)
(a)
(b)
(c)As expected, due to the fact that each column’s and row’s intrinsic properties were used to compute the number of their circular shifts, the proposed image encryption scheme has no immunity to this kind of attacks, statement strengthened by MSE measure’s values (2.515 · 103 in Figure 9(a) and 2.372 · 103 in Figure 9(b), resp., 5.599 · 103 in Figure 10(a) and 5.697 · 103 in Figure 10(b)).


## 3.6.2. Cropping Attacks

Cropping attacks consist of modifying the intercepted encrypted image by deleting one, or several of its areas. To measure robustness of proposed encryption scheme against this kind of attacks, MSE measure is used also.Figures9 and 10 illustrate decrypted image, in cases where their encrypted version was attacked by cropping one 1/8 of its area (c).Same problem is raised by the shuffling procedure mode of operation, and proposed image encryption scheme cannot handle such type of attacks, statement strengthened by MSE measure’s values (3.031 · 103 in Figure 9(c) and 6.043 · 103 in Figure 10(c)).From the previous results, we can conclude that random noise attacks, seriously affect decrypted images. As a proposal, if it is known that the proposed encryption scheme will be used within a communication system susceptible to perturbations, algorithms (or systems) to ensure data integrity should be used, as the one shown in [31].


## 3.7. Speed Test

Another important matter taken into account when new image encryption techniques are proposed is the actual algorithm execution speed.Regardless ofβ1 and β2 variations, shuffling time is of 0.2158 s while the deshuffling time is of 0.1987 s. Obviously, these timings are increasing proportionally with α number of iterations. With an actual ciphering time of 0.1826 s and a deciphering time of 0.1701 s, proposed scheme’s encryption and decryption speeds are smaller than 0.40 s (more accurately, 0.3984 s and 0.3688 s). Achieved speed is superior, in comparison with those of other algorithms [1, 5, 13–16].The speed test was performed on the512×512 pixels, 8-bit, gray-level, Lena standard test image.All the previous results (i.e., numerical results presented in the entire Section3) were generated with proposed encryption algorithm’s scripts for (de)shuffling and (de)ciphering written on MATLAB 7.3.0 and ran on an Intel Pentium Dual CPU T3200 @ 2.00 GHz personal computer.


## 4. Conclusions

This work develops novel permutation—substitution image encryption architecture, based on Rubik’s cube principle and digital chaotic cipher.The proposed encryption system includes two major parts, chaotic pixels substitution (in order to achieve desired diffusion factor) and Rubik’s cube, principle based, pixels permutation (in order to achieve desired confusion factor).Different keys were used for shuffling and ciphering procedures, and while a tent map was used to generate image’s ciphering matrices, each row’s and column’s intrinsic properties were used to compute the number of their circular shifts.Comprehensive experimental tests have been carried out, and numerical analyses have shown robustness of the proposed algorithm against several cryptanalytic attacks. Likewise, the performance assessment tests attest that the proposed image encryption scheme is fast and highly secure. Although a much smaller key space is used, but still large enough to face against exhaustive attack, with a smaller key size, the proposed encryption scheme presents better results, compared to those of previously proposed ones.As future work, an actual implementation on FPGA (focused on the optimization of proposed algorithm, for parallel computing) as well as the investigation of lossless image compression and (or) noise protection schemes (i.e., taking into consideration shortcoming of “how to use” proposal [31]) is concerned.



---

*Source: 848392-2013-03-13.xml*