# A Novel Fuzzy Encryption Technique Based on Multiple Right Translated AES Gray S-Boxes and Phase Embedding

Authors: Naveed Ahmed Azam
Journal: Security and Communication Networks
 (2017)

---

## Abstract

This paper presents a novel image encryption technique based on multiple right translated AES Gray S-boxes (RTSs) and phase embedding technique. First of all, a secret image is diffused with a fuzzily selected RTS. The fuzzy selection of RTS is variable and depends upon pixels of the secret image. Then two random masks are used to enhance confusion in the spatial and frequency domains of the diffused secret image. These random masks are generated by applying two different RTSs on a host image. The decryption process of the proposed cryptosystem needs the host image for generation of masks. It is therefore, necessary, to secure the host image from unauthorized users. This task is achieved by diffusing the host image with another RTS and embedding the diffused secret image into the phase terms of the diffused host image. The cryptographic strength of the proposed security system is measured by implementing it on several images and applying rigorous analyses. Performance comparison of the proposed security technique with some of the state-of-the-art security systems, including S-box cryptosystem and steganocryptosystems, is also performed. Results and comparison show that the newly developed cryptosystem is more secure.


---

## Body

## 1. Introduction

The demand of security of digital images is increased due to extensive transmission of different image files through internet [1, 2]. Therefore, it is essential to develop some algorithms to secure secret images. Different types of image security techniques are proposed by the researchers. Cryptography and steganography are two different widely used techniques for securing the content of secret images. The basic principle of cryptography is to transform secret image (plain image) into diffused image (cipher image) by creating confusion in its information. In many cryptosystems, substitution box (S-box) is solely responsible for creation of diffusion in image [3]. Daemen and Rijmen proposed a block cipher which is used by National Institute of Standard and Technology as Advanced Encryption Standard (AES) [4]. At present, AES is commonly used cryptosystem. Due to the fundamental role of S-box in AES, many cryptographers have paid their attention to study the AES S-box. An algebraic expression for Rijndael block cipher is presented in [5]. In [6], a new simple mathematical description of the AES S-box is given. A permutation polynomial representation of the AES S-box is presented in [7]. It is observed that the polynomial of the AES S-box has only nine nonzero terms which reveals that the security of AES is suspected against computational attacks [6, 7]. In order to remove this weakness of AES, many researchers have proposed new S-boxes (e.g., refer to [8–13]). In [8], an improved S-box is proposed. The drawback of their work is that their S-box cannot be implemented by using the existing framework of AES. The reason behind low complexity of the AES S-box is identified in [9]. Moreover, a new version of S-box is also presented in [9]. In [10], another S-box is developed based on affine mapping having 253 nonzero terms in its polynomial and reuses the existing implementation of AES. The algebraic complexity of the AES S-box is further enhanced by introducing a new S-box based on Gray codes in [11]. The improved S-box has 255 nonzero terms and reuses the whole existing framework of AES. A generalization of Gray S-box is presented in [12]. Right translation and regular representation of Galois field GF(28) are used to generate 256 different RTSs all with high algebraic complexity and satisfying other security tests including nonlinearity, bit independence, strict avalanche, linear approximation, differential approximation, algebraic complexity, correlation, and histogram. Similar to Gray S-box, RTSs are also compatible with the existing implementation of AES S-box. Furthermore, it is claimed in [12] that the latest computational attacks, such as linear, differential, and algebraic attacks [14, 15], can be effectively encountered with a cryptosystem based on multiple S-boxes as compared to a security system relaying on single S-box.In steganography, secret image is embedded into another image called host image. The embedding is done in such a way that unauthorized users cannot detect the presence of the secret image in the resulting image [16–19]. Recently, many scientists have developed new image security algorithms based on combination of cryptography and steganography. In [20], a steganocryptosystem is proposed by using optical encryption, phase embedding, and fixed data hiding technique for Gray scale images. In [21], an improved version of steganocryptosystem with adaptive data hiding technique is presented. Chaotic S-boxes are used to improve the security of secret image after embedding it into a host image in [22]. In [23], secret image is first encrypted by AES and then embedded into host image by using least significant bit (LSB) embedding technique. Similarly, many other researchers proposed steganocryptosystems (e.g., refer to [24–27]).In this paper, we propose a novel image security system based on variable multiple RTSs and steganography. The proposed technique uses four different RTSs and phase embedding technique. Fuzzy approach is used for the selection of RTSs which depends upon pixels of the secret image. The proposed algorithm also utilizes spatial and frequency domains of the secret image for confusion purpose. The aim of this technique is to develop a security system which can efficiently resist the computational attacks as compared to single S-box security techniques and steganocryptosystems. Several tests are applied on the proposed cryptosystem to evaluate its security strength. The experimental results show that the proposed security technique has high resistance against computational attacks as compared to some of the well-known existing security algorithms. Rest of the paper is organized as follows: Section2 consists of preliminaries. Novel encryption technique is presented in Section 3. Section 4 consists of analyses and comparisons. Finally, conclusion and future directions are given in Section 5.


## 2. Preliminaries

### 2.1. Fuzzy Set

A fuzzy set is a pair(f,X), where X is a set and f is a function from set X to the interval [0,1]. The function f is called membership function and it indicates the grade of membership of elements of X in (f,X). Nowadays, fuzzy theory is widely used in many cryptosystems (e.g., refer to [28–30]).


### 2.2. Right Translated AES Gray S-Boxes (RTSs)

A technique for the generation of multiple S-boxes is introduced in [12]. This technique uses the regular representation of Galois field GF(28) and Gray codes [31]. The main advantage of this technique is that it generates an algebraically complex S-box corresponding to each element of GF(28). Since there are 256 elements in GF(28), therefore there are 256 different RTSs. The mathematical expression for the generation of RTSs is given below:(1)ξg=SAES∘ρg∘G,where g is an element of GF(28), SAES is the AES S-box, ρg is a permutation representation of g, G is the Gray code mapping, and ξ(g) is the resultant RTS corresponding to g.


## 2.1. Fuzzy Set

A fuzzy set is a pair(f,X), where X is a set and f is a function from set X to the interval [0,1]. The function f is called membership function and it indicates the grade of membership of elements of X in (f,X). Nowadays, fuzzy theory is widely used in many cryptosystems (e.g., refer to [28–30]).


## 2.2. Right Translated AES Gray S-Boxes (RTSs)

A technique for the generation of multiple S-boxes is introduced in [12]. This technique uses the regular representation of Galois field GF(28) and Gray codes [31]. The main advantage of this technique is that it generates an algebraically complex S-box corresponding to each element of GF(28). Since there are 256 elements in GF(28), therefore there are 256 different RTSs. The mathematical expression for the generation of RTSs is given below:(1)ξg=SAES∘ρg∘G,where g is an element of GF(28), SAES is the AES S-box, ρg is a permutation representation of g, G is the Gray code mapping, and ξ(g) is the resultant RTS corresponding to g.


## 3. The Proposed Security System

In this section, we presented a new security system based on RTSs and steganography. LetI be a secret image and J a host image. Both I and J are Gray scale images of same dimensions M×N. The main steps of the proposed encryption and decryption algorithms are given below.


### 3.1. The Encryption Algorithm

Step 1.
Fuzzy selection criterion for RTS:(a)
Define a fuzzy set(f,GF(28)) by(2)fg=#gM×N,where#(g) is the frequency of g in I. This fuzzy set gives the grade of membership of each element of Galois field GF(28) in the secret image.(b)
Supposel is the supremum of the range of f; that is, l=sup⁡fg.(c)
Now, calculate preimagesg1,g2,g3,…,gn of l. The infimum g of the preimages is the minimum element of GF(28) which has maximum grade of membership in the secret image I.(d)
DiffuseI with ξ(g), RTS corresponding to g, to get Ig.Step 2.
Generation of random masks and confusion in spatial and frequency domains:(a)
Fix an elementc of GF(28) and select three RTSs ξS1,ξS2,andξ(S3) by using (1) and following three equations:(3)S1=g+c,mod⁡256,S2=S1+c,mod⁡256,S3=S2+c,mod⁡256.(b)
Applyξ(S1)andξ(S2) on the host image J to get its two different diffused versions J1 and J2.(c)
Now generate two random masksR1 and R2 for creation of confusion in spatial and frequency domains of the diffused secret image Ig. The mathematical expressions of these masks are given below:(4)R1=exp⁡iπJ1128,R2=exp⁡iπJ2128.The random noise is then generated in the content ofIg by using(5)IR=F-1FIg×R1×R2,whereF is the Fourier transformation and F-1 is the inverse Fourier transformation.Step 3.
Securing the host image and embedding process:
The process of decryption cannot be completed untilR1 and R2 are known. Traditionally, R1 and R2 can be retrieved by embedding them in IR. But, this process increases the size of encrypted image and affects the quality of decrypted image [20–22]. Despite this, we embed IR in the host image because R1 and R2 can be regenerated by J. The host image is secured from third party by diffusing J with RTS corresponding to S3, that is, ξ(S3). Finally, IR and g are embedded in the phase terms of the diffused host image J3. The following is the mathematical equation of embedding process:(6)IS=J3exp⁡iπ2IR.The proposed encryption process is elaborated in Figure1(a).Figure 1
(a) Flowchart of encryption algorithm. (b) Flowchart of decryption algorithm.
(a) (b)


### 3.2. The Decryption Algorithm

Step 1.
In the decryption process, first of allJ3, IR, and g are extracted by calculating complex modulus and argument of IS:(7)J3=IS,IR=2πarg⁡IS.Step 2.
Apply inverse ofξ(S3) on J3 to generate random masks R1 and R2 by using Step 2 of the proposed encryption technique. Now, calculate their complex conjugates R1¯ and R2¯ because they can cancel the effect of random masks as shown below:(8)R1×R1¯=exp⁡iπJ1128×exp⁡-iπJ1128=exp⁡iπJ1128-iπJ1128=exp⁡0=1.Step 3.
Next, random masks are removed by using the following equation:(9)Ig=F-1FIR×R2¯×R1.Step 4.
Finally, inverse of RTS corresponding tog is applied on Ig to restore the secret image I.The flowchart of the proposed decryption process is shown in Figure1(b).


## 3.1. The Encryption Algorithm

Step 1.
Fuzzy selection criterion for RTS:(a)
Define a fuzzy set(f,GF(28)) by(2)fg=#gM×N,where#(g) is the frequency of g in I. This fuzzy set gives the grade of membership of each element of Galois field GF(28) in the secret image.(b)
Supposel is the supremum of the range of f; that is, l=sup⁡fg.(c)
Now, calculate preimagesg1,g2,g3,…,gn of l. The infimum g of the preimages is the minimum element of GF(28) which has maximum grade of membership in the secret image I.(d)
DiffuseI with ξ(g), RTS corresponding to g, to get Ig.Step 2.
Generation of random masks and confusion in spatial and frequency domains:(a)
Fix an elementc of GF(28) and select three RTSs ξS1,ξS2,andξ(S3) by using (1) and following three equations:(3)S1=g+c,mod⁡256,S2=S1+c,mod⁡256,S3=S2+c,mod⁡256.(b)
Applyξ(S1)andξ(S2) on the host image J to get its two different diffused versions J1 and J2.(c)
Now generate two random masksR1 and R2 for creation of confusion in spatial and frequency domains of the diffused secret image Ig. The mathematical expressions of these masks are given below:(4)R1=exp⁡iπJ1128,R2=exp⁡iπJ2128.The random noise is then generated in the content ofIg by using(5)IR=F-1FIg×R1×R2,whereF is the Fourier transformation and F-1 is the inverse Fourier transformation.Step 3.
Securing the host image and embedding process:
The process of decryption cannot be completed untilR1 and R2 are known. Traditionally, R1 and R2 can be retrieved by embedding them in IR. But, this process increases the size of encrypted image and affects the quality of decrypted image [20–22]. Despite this, we embed IR in the host image because R1 and R2 can be regenerated by J. The host image is secured from third party by diffusing J with RTS corresponding to S3, that is, ξ(S3). Finally, IR and g are embedded in the phase terms of the diffused host image J3. The following is the mathematical equation of embedding process:(6)IS=J3exp⁡iπ2IR.The proposed encryption process is elaborated in Figure1(a).Figure 1
(a) Flowchart of encryption algorithm. (b) Flowchart of decryption algorithm.
(a) (b)


## 3.2. The Decryption Algorithm

Step 1.
In the decryption process, first of allJ3, IR, and g are extracted by calculating complex modulus and argument of IS:(7)J3=IS,IR=2πarg⁡IS.Step 2.
Apply inverse ofξ(S3) on J3 to generate random masks R1 and R2 by using Step 2 of the proposed encryption technique. Now, calculate their complex conjugates R1¯ and R2¯ because they can cancel the effect of random masks as shown below:(8)R1×R1¯=exp⁡iπJ1128×exp⁡-iπJ1128=exp⁡iπJ1128-iπJ1128=exp⁡0=1.Step 3.
Next, random masks are removed by using the following equation:(9)Ig=F-1FIR×R2¯×R1.Step 4.
Finally, inverse of RTS corresponding tog is applied on Ig to restore the secret image I.The flowchart of the proposed decryption process is shown in Figure1(b).


## 4. Security Analyses and Comparison

We implemented the proposed technique and other security systems, presented in [10–12, 23, 24, 32–34], with the help of Matlab on 31 Gray scale images of dimensions 225×225. These test images were taken from [35]. We used image of Lena as host image for our experiments. The aim of this section is to investigate and compare the strength of the proposed security algorithm with some of the existing cryptosystems based on single S-box and combination of S-box and steganography.


### 4.1. Objective Fidelity Criteria

The purpose of this experiment is to measure the amount of error in the reconstructed image and original image. A cryptosystem is good if the value of error is high and if the value of error is small then the security of cryptosystem is suspicious. Root mean square error (RMSE) and peak signal to noise ratio (PSNR) are the two commonly used parameters to measure the level of fidelity [36–38]. RMSE and PSNR are given by the equations:(10)RMSE=∑x=1M∑y=1NIx,y-I′x,y2M×N,PSNR=10log10⁡2552∑x=1M∑y=1NIx,y-I′x,y2×M×N,where I denotes plain image and I′ denotes cipher image.We applied fidelity analysis on the proposed technique and other security systems. A comparison of the experimental results is given in Figures2(a) and 2(b). It is clear from Figures 2(a) and 2(b) that the proposed cryptosystem is creating maximum value of RMSE and minimum value of PSNR as compared to other security techniques. Hence, the proposed technique is satisfying objective fidelity criterion efficiently more than that of other cryptosystems.Figure 2
(a) Results and comparison of RMSE. (b) Results and comparison of PSNR.
(a) (b)


### 4.2. Sensitivity Analysis

Generally, a cryptanalyst uses differential attack to steal the information from the ciphered image. In this attack a slight change is produced in the pixels of the image to analyze the extent of change in the resultant image. Unified average changing intensity (UACI) is used to measure the level of security of a cryptosystem against differential attack [32, 39]. The mathematical expression for calculation of UACI is given below:(11)UACI=1M×N∑x=1M∑y=1NIx,y-I′x,y255×100.The results of this experiment are shown in Figure 3. It is evident from Figure 3 that the proposed technique generates maximum value of UACI. Hence it resists differential attack efficiently as compared to other techniques.Figure 3
Results and comparison of UACI.


### 4.3. Correlation and Contrast Analysis

The pixels of plain image are highly correlated in horizontal, vertical, and diagonal directions. A cryptosystem is secure if it can reduce correlation and increase contrast between pixels significantly. The correlation coefficientrxy is calculated by the following expression:(12)rxy=cov⁡x,yHxHy,where(13)cov⁡x,y=1M∑i=1Mxi-Exyi-Ey,Hx=1M∑i=1Mxi-Ex2,Ex=1M∑i=1Mxi.We calculated the correlation of pixels in vertical, horizontal, and diagonal directions and their results are plotted in Figures 4(a)–4(c). The results of contrast analysis are shown in Figure 4(d). These figures indicate that the proposed security technique produces minimum correlation and maximum contrast.Figure 4
(a) Results and comparison of vertical correlation. (b) Results and comparison of horizontal correlation. (c) Results and comparison of vertical correlation. (d) Results and comparison of contrast analysis.
(a) (b) (c) (d)


### 4.4. Spectrum Magnitude Analysis

In an image, the frequency spectrum is not uniformly distributed. A cryptosystem is said to be good if it distributes frequency uniformly and creates significant difference between the spectrums of plain image and cipher image. We have applied this test on all 31 images. Three encrypted images and their frequency spectrums are shown in Figures5(g)–5(i) and Figures 5(j)–5(l), respectively. Figures 5(d)–5(f) show frequency spectrums of the secret images. Note that the frequency distribution in Figures 5(d)–5(f) is concentrated in a small region located in the middle of each image. Usually, this small region suffers from security attacks. It is evident from Figures 5(j)-5(i) that the frequency is distributed uniformly in the encrypted images. Hence, encrypted images by the proposed scheme are secure against statistical attacks.Figure 5
(a) Secret image. (b) Secret image. (c) Secret image. (d) Frequency spectrum of (a). (e) Frequency spectrum of (b). (f) Frequency spectrum of (c). (g) Encryption of (a). (h) Encryption of (b). (i) Encryption of (c). (j) Frequency spectrum of (g). (k) Frequency spectrum of  (h). (l) Frequency spectrum of (i).
(a) (b) (c) (d) (e) (f) (g) (h) (i) (j) (k) (l)


## 4.1. Objective Fidelity Criteria

The purpose of this experiment is to measure the amount of error in the reconstructed image and original image. A cryptosystem is good if the value of error is high and if the value of error is small then the security of cryptosystem is suspicious. Root mean square error (RMSE) and peak signal to noise ratio (PSNR) are the two commonly used parameters to measure the level of fidelity [36–38]. RMSE and PSNR are given by the equations:(10)RMSE=∑x=1M∑y=1NIx,y-I′x,y2M×N,PSNR=10log10⁡2552∑x=1M∑y=1NIx,y-I′x,y2×M×N,where I denotes plain image and I′ denotes cipher image.We applied fidelity analysis on the proposed technique and other security systems. A comparison of the experimental results is given in Figures2(a) and 2(b). It is clear from Figures 2(a) and 2(b) that the proposed cryptosystem is creating maximum value of RMSE and minimum value of PSNR as compared to other security techniques. Hence, the proposed technique is satisfying objective fidelity criterion efficiently more than that of other cryptosystems.Figure 2
(a) Results and comparison of RMSE. (b) Results and comparison of PSNR.
(a) (b)


## 4.2. Sensitivity Analysis

Generally, a cryptanalyst uses differential attack to steal the information from the ciphered image. In this attack a slight change is produced in the pixels of the image to analyze the extent of change in the resultant image. Unified average changing intensity (UACI) is used to measure the level of security of a cryptosystem against differential attack [32, 39]. The mathematical expression for calculation of UACI is given below:(11)UACI=1M×N∑x=1M∑y=1NIx,y-I′x,y255×100.The results of this experiment are shown in Figure 3. It is evident from Figure 3 that the proposed technique generates maximum value of UACI. Hence it resists differential attack efficiently as compared to other techniques.Figure 3
Results and comparison of UACI.


## 4.3. Correlation and Contrast Analysis

The pixels of plain image are highly correlated in horizontal, vertical, and diagonal directions. A cryptosystem is secure if it can reduce correlation and increase contrast between pixels significantly. The correlation coefficientrxy is calculated by the following expression:(12)rxy=cov⁡x,yHxHy,where(13)cov⁡x,y=1M∑i=1Mxi-Exyi-Ey,Hx=1M∑i=1Mxi-Ex2,Ex=1M∑i=1Mxi.We calculated the correlation of pixels in vertical, horizontal, and diagonal directions and their results are plotted in Figures 4(a)–4(c). The results of contrast analysis are shown in Figure 4(d). These figures indicate that the proposed security technique produces minimum correlation and maximum contrast.Figure 4
(a) Results and comparison of vertical correlation. (b) Results and comparison of horizontal correlation. (c) Results and comparison of vertical correlation. (d) Results and comparison of contrast analysis.
(a) (b) (c) (d)


## 4.4. Spectrum Magnitude Analysis

In an image, the frequency spectrum is not uniformly distributed. A cryptosystem is said to be good if it distributes frequency uniformly and creates significant difference between the spectrums of plain image and cipher image. We have applied this test on all 31 images. Three encrypted images and their frequency spectrums are shown in Figures5(g)–5(i) and Figures 5(j)–5(l), respectively. Figures 5(d)–5(f) show frequency spectrums of the secret images. Note that the frequency distribution in Figures 5(d)–5(f) is concentrated in a small region located in the middle of each image. Usually, this small region suffers from security attacks. It is evident from Figures 5(j)-5(i) that the frequency is distributed uniformly in the encrypted images. Hence, encrypted images by the proposed scheme are secure against statistical attacks.Figure 5
(a) Secret image. (b) Secret image. (c) Secret image. (d) Frequency spectrum of (a). (e) Frequency spectrum of (b). (f) Frequency spectrum of (c). (g) Encryption of (a). (h) Encryption of (b). (i) Encryption of (c). (j) Frequency spectrum of (g). (k) Frequency spectrum of  (h). (l) Frequency spectrum of (i).
(a) (b) (c) (d) (e) (f) (g) (h) (i) (j) (k) (l)


## 5. Conclusion

In this study, we proposed a Gray scale image encryption technique based on RTSs and steganography. The proposed cryptosystem uses multiple RTSs and phase embedding technique for the generation of confusion in spatial and frequency domains of secret image. Fuzzy approach is used for the selection of RTSs. Analyses and comparison showed that the proposed security system is more secure as compared to some of the well-known cryptosystems based on single S-box and combination of S-box and steganography. In future, the newly developed algorithm can be used for the encryption of color image and data hiding purpose with some modifications.



---

*Source: 5790189-2017-01-11.xml*