Literature DB >> 36090155

Improved affine encryption algorithm for color images using LFSR and XOR encryption.

Ayşegül Ihsan1, Nurettin Doğan2.   

Abstract

In this study, a novel Improved Affine Algorithm (IAA) for color image encryption is proposed. Affine Algorithm (AA) is generally known as an algorithm used for plain text encryption. In the proposed IAA algorithm, Linear Feedback Shift Register (LFSR), XOR encryption, and the AA are combined for color images encryption. The plane image is firstly split into three channels: R, G, and B. The RGB channel image is encrypted using AA encryption with ten keys based on pixel locations and pixel values. The rows and columns of the image are encrypted with LFSR keys and XOR encryption procedures. Finally, the proposed algorithm is tested in Matlab environment to obtain the Histogram, Mean Square Error (MSE), Peak Signal to Noise Ratio (PSNR), Unified Average Changing Intensity (UACI), Number of Pixel Change Rate (NPCR), and Entropy analyses. The values are compared with other algorithms. The results show that the proposed image encryption algorithm is secure and powerful, outperforming other algorithms.
© The Author(s), under exclusive licence to Springer Science+Business Media, LLC, part of Springer Nature 2022, Springer Nature or its licensor holds exclusive rights to this article under a publishing agreement with the author(s) or other rightsholder(s); author self-archiving of the accepted manuscript version of this article is solely governed by the terms of such publishing agreement and applicable law.

Entities:  

Keywords:  Affine algorithm; Image encryption; Linear feedback shift register; XOR encryption

Year:  2022        PMID: 36090155      PMCID: PMC9440316          DOI: 10.1007/s11042-022-13727-w

Source DB:  PubMed          Journal:  Multimed Tools Appl        ISSN: 1380-7501            Impact factor:   2.577


Introduction

Today, the internet is effective in every aspect of our lives. During the Covid-19 pandemic that we are currently experiencing, people had to stay at home more. Now, the internet is being used more intensively than ever before. All the transactions, such as shopping, banking, and remote working were carried out through the Internet. Apart from these, the use of social media platforms has increased very rapidly. Computers, mobile phones, smartwatches, devices connected to the Internet, security cameras in the areas we live in, and many other devices are all connected to the Internet. These devices send great amounts of data to different parts of the world with high-speed data transfers. Accessing a large amount of data over the Internet creates high-security risks. Many countries have enacted laws on the protection of personal data. In addition to personal data, the security of states is also crucial when sending data over the Internet. One way to securely send digital data over the Internet is encryption and the other is using steganography. The information to be encrypted can be plain text or an image. Affine Algorithm is one of the encryption techniques used by cryptographers for plain text. However, it is possible to use AA for image encryption as well. Because the AA includes several operations including translation, scaling, rotation, and truncation, it can also be used for pixel scrambling in image encryption. However, despite these features, the use of AA alone for image encryption is not enough to make good encryption. Therefore, stronger encryption processes are required. Many researchers tried to develop stronger image encryption methods by using AA, LFSR, XOR encryption and other methods together. Lone et al. encoded the image using a random Affine encryption matrix, 2D Hénon, and a chaotic map [18]. Sayed et al. studied Affine encryption with six parameters [25]. Wang et al. combined AA encryption with the zigzag method [29]. They represented secure image encryption with pixel and AA encryption in this study [30]. Chen et al. proposed an encryption algorithm using the AA and Fractional Fourier Encryption [6]. Multilayer resilient color image encryption with random matrix AA was studied [24]. Khan et al. used an S8 permutation of double-AA in S-boxes and a nonlinear Lorentz dynamics system for image encryption [11]. Deb and Bhuyan proposed a new medical image encryption system using a special nonlinear filter function based on Linear Feedback Shift Register (LFSR) [8]. Momeni et al. proposed color image encryption method using LFSR by three dimensional permutation and substitution operations [20]. Masood et al. proposed a lightweight chaos-based medical image encryption scheme using random shuffling and XOR operations [19]. Thinnukool et al. double encryption algorithm using trigonometric chaotic map and XOR of an image [28]. In this study, a new color image encryption algorithm is proposed using LFSR technique known as a random number generator and XOR encryption together with AA, and this algorithm is called Improved Affine Algorithm (IAA). In image encryption, the LFSR is used for key generation. The XOR encryption method is preferred because it is a simple and complex structure. The XOR encryption method is used with LFSR keys. The main contributions of this study can be summarized as follows: In this study, the IAA algorithm developed for color image encryption is used. The user selects ten different keys for AA encryption. The original image is split into three channels: R, G, and B. The image is encrypted with AA using four keys based on pixel locations and six keys based on pixel values. The rows and columns of the image are encrypted using the LFSR 256-key and XOR encryption. The proposed algorithm is tested with the Histogram, MSE, PSNR, UACI, NPCR, and Entropy. A comprehensive analysis is provided by comparing IAA with other encryption algorithms in the literature. The IAA achieves remarkable improvement and outperforms other encryption algorithms compared in this study. The content provided in the rest of this paper is organized as follows: In Section 2, Affine Algorithm, Linear Feedback Shift Register, and XOR encryption with LFSR are briefly explained. Section 3 describes the proposed encryption algorithm in detail. In Section 4, the experiments and comparisons are presented, and the results are discussed. Finally, conclusions and future works are given in Section 5.

Background

Affine Algorithm (AA), Linear Feedback Shift Register (LFSR), and XOR encryption with the LFSR approach is examined in this section. Following that, the proposed algorithm is examined.

Affine algorithm

Affine cipher is a type of classical substitution cipher used in cryptography. It was initially created to encrypt a set of 26 English characters. AA is a widely used and well-known encryption method. AA is a multi-key encryption algorithm. The structure of AA is more complex and secure than that of single-key encryption algorithms [18, 25, 29, 30]. AA is used for both text encryption and image decryption. In this study, AA is used for image encryption. For MxN pixel sizes images, AA formula is shown in Eq. (1) and AA decryption formula is shown in Eq. (2). where y is the encryption operation and is the decryption operation. The keys used in AA (Eq. 1 and Eq. 2) are denoted as the a-key and the b-key. For decryption, the Greatest Common Divisor (GCD) must be equal (a, N) = 1. Consequently, the a-key should not have a common divisor of N and the b-key should be selected from 0 to N-1.

Linear feedback shift register

A perfectly random series of integers is required when encrypting images with LFSR [1]. After all subsequent numbers have been generated, the first numbers are traced. During this process, the digits are carried over the register. The bits are shifted one position to the left, and the shifted bit and the bit previously at a particular step position in the register replace the released bit. The length of the LFSR is [q, q, q, ..., q], where q is the number of circuits and j is the number of registers in the LFSR and the flip-flop circuits can be increased or decreased arbitrarily. It is represented by the clock (c) of the LFSR, where (c) is the number of records in the LFSR. In LFSR, the first numbers are randomly generated. The first numbers are used to generate the second numbers with the XOR operation. To generate the second numbers, the first numbers are shifted in the register. While shifting, the value of the q is shifted to the q. The value of q is then XORed by the value of the q and the result obtained is used as the new value of the q. The identical actions are performed again and again until the last number is generated. In Fig. 1, the LFSR shift operations and operations to generate new numbers are specified with colors and the colors can be used to track the shifts.
Fig. 1

An example of the LFSR in a numerical procedure

An example of the LFSR in a numerical procedure In Fig. 1, the LFSR is 3 bits long and is represented by q, q, and q. The LFSR time is represented by c. In this example, the q and the q are created randomly (q = 0 and q = 1). The initial time (c) is the result of the XOR operation of the q and the q ((c) q = 0 ⊕ q = 1 → q = 1). Then, the q on c is shifted to q on c, and the green color is used to describe this operation on c and c. In c, q and q are XORed, and q is updated as a result ((c) q = 1 ⊕ q = 0 → q2 = 1). After that, q on c is shifted to q on c and the blue color is used to describe this operation on c and c. To produce ten distinct integers, nine feedback shift operations (c) are conducted. All operations can be understood by following the colors. The LFSR is commonly used to generate encryption keys. Key generation using LFSR is used in various encryption techniques in the literature.

XOR encryption with LFSR

XOR encryption is a text and image encryption algorithm. Random keys are generated by LFSR, and the key and pixel values are encrypted in XOR encryption. The XOR operation is preferred by many cryptographers because it is more secure. The LFSR is used to generate the key in the XOR encryption. The flowchart of encryption algorithms with XOR encryption with LFSR is shown in Fig. 2.
Fig. 2

Combination of XOR encryption with LFSR

Combination of XOR encryption with LFSR In Fig. 2, XOR encryption with LFSR, the color image is selected first. In LFSR, random numbers are first used for key generation, and LFSR is tuned to generate keys for each column. New pixel values are found with random numbers. After shuffling the pixels, a row encryption image is obtained. The decryption step uses the same key as the encryption step. For column encryption, a sequence of random numbers is generated, which is to be converted into a matrix. This method rearranges or swaps the pixel values of the image by using the random matrix. Column encryption is studied on the row-encrypted image. As a result, the image is encrypted using XOR encryption with LFSR encryption methods. Encryption is column-wise and row-wise, and multiple keys are used.

Proposed approach

In this study, the images named Lena, Baboon, Airplane, and Pepper are used. The size of each image is 256 × 256 pixels. For this reason, in this study, explanations will be made for images with a resolution of 256 × 256 pixels from now on. The algorithm is applied to the RGB channels of the color image separately. The algorithm is developed in three steps: (i) Pixel Locations Encryption using AA, (ii) Pixel Values Encryption using AA, (iii) XOR encryption with LFSR. (i) Pixel locations encryption using AA The plain image is split into three RGB channels. The algorithm is applied to each RGB channel of the color image separately. The four keys: a, b, a, and b are used in this step. Since the size of each image is 256 × 256 pixels, b and b should be chosen between 0 and 255. a, and a should be chosen so that GCD(a,256) = 1. In this stage, firstly Pixel locations of the image are encrypted using Eq. (1) for the a and b keys. Secondly, Pixel locations of the image are encrypted using Eq. (1) for a and b keys. The encryption processes are visualized in Fig. 3.
Fig. 3

AA encryption for the color Lena image’s pixel locations

AA encryption for the color Lena image’s pixel locations The original image is shown in Fig. 3a and the encryption of the original image is shown in Fig. 3b by encrypting pixel positions with two keys. Finally, the pixel locations are encrypted a second time using two keys, as shown in Fig. 3c. (ii) Pixel values encryption using AA The pixel values of the image in each channel of the color image are encrypted with AA, and the encryption is performed with Eq. (1). A total of six keys are used for pixel value encryption. The a, b keys are used for the R channel, the a, b keys are used for the G channel, and the a, b keys are used for the B channel. In this step, a total of six keys are utilized for encryption. In Fig. 4, the image is divided into RGB channels and AA encryption is applied to the image pixel values with a total of six keys: two keys for the R channel, two keys for the G channel, and two keys for the B channel. The encrypted image is concatenated after the channels are encrypted. Encrypting channels individually and with different keys improved the security.
Fig. 4

AA pixel values encryption for RGB channels

(iii) XOR encryption with LFSR AA pixel values encryption for RGB channels LFSR generates a total of 256 different keys for a 256 × 256 image. LFSR key is used to XOR encrypt each pixel of the image. At this stage, XOR encryption is applied twice. In the first step, the rows of the image are encrypted with XOR using the key generated with LFSR. In the second step, the columns of the image are encrypted with XOR. Then, all the operations are repeated and the encryption process is completed. Therefore, a strongly encrypted image is obtained with IAA. The image is encrypted and decrypted using the same keys. The decryption procedure occurs in the opposite direction of the encryption procedure. The block diagram of the image encryption algorithm is shown in Fig. 5. The block diagram of the image decryption algorithm is shown in Fig. 6. The procedures of the encryption algorithm are shown in Fig. 7 whereas the procedures of the decryption algorithm are shown in Fig. 8.
Fig. 5

Block diagram of the encryption of the IAA

Fig. 6

Block diagram of the decryption of the IAA

Fig. 7

The image encryption procedures of the IAA

Fig. 8

The image decryption procedures of the IAA

Block diagram of the encryption of the IAA Block diagram of the decryption of the IAA The image encryption procedures of the IAA The image decryption procedures of the IAA

Results and analysis

The proposed algorithm is tested with the Histogram, MSE, PSNR, UACI, NPCR, and Entropy analyses. After the encryption tests, the structural content is examined to determine the best algorithm for image encryption and the success of the proposed algorithm is compared with other encryption algorithms. It is explained in detail in this section. The content provided in the rest of this section is organized as follows: In Section 4.1, Experimental Analysis is briefly summarized. In Section 4.2, the proposed algorithm is compared using the Histogram, MSE, PSNR, NPCR, UACI, and Entropy analyses. The experiments and comparisons are presented, and the results are discussed. Tests and analyses of the proposed algorithm are performed in Section 4.3.

Experimental analysis

In this study, the images named Lena, Baboon, Airplane, and Pepper are used. The size of each image is 256 × 256 pixels. Image encryption is performed with ten different keys. The pixel keys are represented by a, b, a and b and the RGB keys are represented by a, b, a, b, a and b. For LFSR, “11,011,001” is selected as the initial value and set to 8 bits (0 to 255). The keys used in this study are shown in Table 1. The original images, the encrypted images, and the decrypted images are shown in Table 2.
Table 1

Keys determined for IAA

The Key’s NameKeyThe Key’s NameKey
The Initial Value of the LFSR11,011,001b397
a119a4133
b1133b419
a229a5256
b2100b5100
a339
Table 2

The original image, the encrypted image, and the decrypted image with IAA

Keys determined for IAA The original image, the encrypted image, and the decrypted image with IAA Table 2 shows that the encryption and decryption operations are successful. The performance of the proposed algorithm is analyzed in the following section.

Experimental results

The Histogram, MSE, PSNR, NPCR, UACI, and Entropy analyses are explained in this section. Finally, the Histogram, MSE, PSNR, NPCR, UACI, and Entropy analyses are utilized to evaluate the performance of the proposed algorithm.

Histogram analysis

The distribution of the pixel intensities of an image is represented by the Histogram. Also, the analysis of the Histogram shows the probability of hacker-encrypted images being hacked by using frequency data and statistics. The quality of the algorithm used is shown by the homogeneous distribution of the Histogram of the encrypted image [22].

Mean square error and peak signal to noise ratio

The original and encrypted images are compared with Mean Square Error (MSE) [2]. MSE is the mean squared error estimate used to compare possible image differences. In general, the lower the value of MSE, the better the results. In this study, the success of the encrypted image is examined using the MSE value. The original image is represented by I, the decrypted image by , the image size by MxN, ∆x, and ∆y by the pixel size. MSE formula is as shown in Eq. (3). Peak Signal to Noise Ratio (PSNR) shows similarities between images. After encrypting the image, PSNR value is used to measure the image deformations [26]. PSNR value is low after successful encryption. PSNR is expressed in decibels (dB) [4]. PSNR is calculated together with MSE values. PSNR test is performed to measure the security of the encrypted images. Achieving a high score on the PSNR test indicates a successful encryption process. The formula for PSNR is shown in Eq. (4).

Number of pixels change rate and unified average changing intensity

Differential attack analysis is performed to detect changes in encrypted images. The hackers are unable to make any meaningful association with the original images based on a small change in the encrypted images because the small change in the original images is created a large change in the encrypted images. The Number of Pixels Change Rate (NPCR) and Unified Average Change Intensity (UACI) are commonly used to measure the effectiveness of this type of attack. NPCR, pixel change with the original image comparison of the encrypted image shows the change in several pixels of the encrypted image and the rate. UACI rate, the encryption technique against various attacks, is defined as the resistance ratio. The average density difference between the original image and the encrypted image is UACI value [23]. Eq. (5) represents the calculation of the NPCR and Eq. (6) represents the calculation of UACI. where M and N are the width and height of the image. The original image is represented by I, the decrypted image by , the image size by MxN, The difference array D(i, j) is defined as follows: if =I, D(i, j) = 0; otherwise, D(i, j) = 1 [3].

Entropy analysis

Entropy is a significant property that represents the degree of disorder in a system. Entropy is used to calculate the probability of obtaining the original image without knowing the key [5, 14]. Eq. (7) represents the calculation of the value of the Entropy [9]. where N is the number of bits to represent a symbol m ∈ m. Entropy is measured in bits, where P(m) is the probability of the symbol m and the log is the logarithm to base 2. For a source emitting 2N symbols at random, H(m) = N is the Entropy value. The entropy value result is expected to be about 8 (H(m) ≈ 8).

Test and analysis

In this section, MSE, PSNR, UACI, NPCR, and Entropy values are performed to prove that IAA is a successful encryption algorithm. First, the Histograms of the images are analyzed. A homogeneous structure in the encrypted image’s histogram is required for effective encryption. The proposed algorithm is used for the encryption of the color images of Lena, Baboon, Airplane, and Pepper. Table 3 shows the original image histogram, the encrypted image histogram, and the decrypted images. Table 3 compares the histograms of the original image and the decrypted image, and the encrypted images of the Histograms are appeared to be fairly evenly distributed. As a result, IAA is recognized as an efficient form of cryptography.
Table 3

Histogram analysis of the images

Histogram analysis of the images MSE, PSNR, UACI, and NPCR metrics are computed to measure success and resistance to attack, and all results are obtained for each RGB channel of images. PSNR is measured in decibels (dB). UACI and NPCR are calculated in percentages (%). In Table 4, MSE, PSNR, UACI, and NPCR values of RGB channels of images are compared to show the performance of the proposed encryption algorithm. In Table 4, MSE results prove that the original image is obtained after decryption with only minor errors. PSNR results show that IAA encryption is secure for the images. The suggested encryption algorithm is successful in differential attack analysis if NPCR is above 99% and UACI is above 33% [14]. The average NPCR value for all color test images considered in this study is 99.67% and the average UACI value is 33.58%. UACI and NPCR results show that encryption is effective, and the keys are secure. All tests show that IAA’s image encryption algorithm and image decryption algorithm are extremely secure.
Table 4

MSE, PSNR, NPCR and UACI results of the proposed algorithm

Image NameRGB ChannelsPSNRMSENPCRUACI
LenaR19.11858.3816E599.696533.5588
G20.54725.3211E599.657433.5774
B19.87515.3357E599.658832.6485
BaboonR20.19941.277E399.697233.6589
G19.24765.5812E499.667533.5812
B18.81232.2271E499.647933.6127
AirplaneR20.25816.1771E499.697233.4779
G20.13476.1213E599.647733.5538
B20.10238.8741E599.637133.6271
PepperR18.34128.5741E499.698633.4599
G19.85226.4251E599.691533.5471
B20.01786.7732E599.627833.6367
MSE, PSNR, NPCR and UACI results of the proposed algorithm Table 5 compares the MSE results of the proposed algorithm to the results of other image encryption algorithms available in the literature. IAA outperforms the other two algorithms in MSE results. Table 6 shows UACI and NPCR results obtained for Lena, Baboon, Airplane, and Pepper images of the proposed algorithm and various image encryption algorithms in the literature.
Table 5

MSE results of the proposed algorithm and other encryption algorithms

AlgorithmRGB ChannelsLenaBaboonAirplanePepper
Proposed AlgorithmR8.3816E51.277E36.1771E48.5741E4
G5.3211E55.5812E46.1213E56.4251E5
B5.3357E52.2271E48.8741E56.7732E5
Li et al. [13]R1.062E48.618E39.978E37.962E3
G9.046E37.749E31.066E41.123E4
B7.111E39.531E31.043E41.115E4
Etemadi Borujeni et al. [10]R1.032E48.518E39.651E37.828E3
G9.115E37.625E31.040E41.107E4
B7.056E39.439E31.009E41.124E4
Table 6

NPCR and UACI results of the proposed algorithm and other encryption algorithms

AlgorithmNPCRUACI
RGBRGB
Proposed Algorithm99.696599.657499.658833.558833.577432.6485
Murillo et al. [21]99.630099.600099.610033.310033.340033.4300
Kumar et al. [12]99.565999.565899.595933.282933.345933.3270
Teng et al. [27]99.642999.614099.627733.393533.563733.4814
Chidambaram et al. [7]99.612499.614099.620133.423533.483833.5983
MSE results of the proposed algorithm and other encryption algorithms NPCR and UACI results of the proposed algorithm and other encryption algorithms The Entropy values of RGB channels of images are compared to show the performance of the proposed encryption algorithm. Table 7 shows the entropy results of the proposed algorithm. Table 8 shows the proposed algorithm and the results of other algorithms published in the literature.
Table 7

Entropy of the proposed algorithm

Image NameRGB ChannelsOriginal ImageEncrypted Image
LenaR7.2286397.999488
G7.5497857.999514
B6.9675017.999428
BaboonR7.6470457.999425
G7.3619397.999561
B7.6829477.999358
AirplaneR6.7737307.999412
G6.8615687.999389
B6.3313347.999457
PepperR7.3280427.999375
G7.6036657.999563
B7.1449577.999544
Table 8

The Entropy of the encrypted images

AlgorithmImage NameRGB Channels
RGB
Proposed AlgorithmLena7.9994887.9995147.999428
Proposed AlgorithmBaboon7.9994257.9995617.999358
Proposed AlgorithmAirplane7.9994127.9993897.999457
Proposed AlgorithmPepper7.9993757.9995637.999544
Liu et al. [16]Lena7.9898257.9891207.990007
Liu et al. [16]Pepper7.9888997.9894867.989519
Liu et al. [16]Airplane7.9893577.9894727.990092
Liu et al. [17]Lena7.9895677.9885337.989931
Liu et al. [17]Pepper7.9888817.9888737.988577
Zhang et al. [31]Lena7.9973007.9970007.997200
Zhang et al. [31]Pepper7.9972007.9970007.997200
Zhang et al. [31]Baboon7.9993007.9993007.999300
Entropy of the proposed algorithm The Entropy of the encrypted images The minimum value of information Entropy analysis is zero, whereas the maximum value is eight [15]. Table 7 shows the RGB channel information entropy values for the proposed algorithm. Entropy analysis of the purposed algorithm is calculated as H(m) ≈ 8. The entropy analysis of the suggested algorithm is compared with the entropies of various encryption algorithms in Table 8. Table 8 shows that IAA is a more highly secure cryptographic procedure than other encryption algorithms. All tests and analyses proved that IAA is a safe encryption algorithm. As a consequence, the proposed algorithm is extremely robust against Entropy attacks on image predictions.

Conclusion

In this study, a novel color image encryption algorithm named Improved Affine Algorithm (IAA) is developed. IAA is performed in three procedures. In the first step, the plain image is split into three channels: R, G, and B. The RGB channel pixel locations are encrypted two times with four different keys using Affine Algorithm (AA). In the second step, the RGB channel pixel values are encrypted separately with a total of six different keys using AA. Finally, the rows and columns of the image are XOR encrypted with 256 keys using LFSR. The decryption procedure occurs in the opposite direction of the encryption procedure. The proposed algorithm is used for the encryption of the color images of Lena, Baboon, Airplane, and Pepper. IAA has successfully performed encryption operations and decryption operations. Further, the Histogram, MSE, PSNR, UACI, NPCR, and Entropy values are measured the purpose algorithm’s performance. The experimental results are compared to other encryption algorithms. The analyses and comparisons show that the proposed encryption algorithm is highly secure against various attacks.
  1 in total

1.  Hyper-Chaotic Color Image Encryption Based on Transformed Zigzag Diffusion and RNA Operation.

Authors:  Duzhong Zhang; Lexing Chen; Taiyong Li
Journal:  Entropy (Basel)       Date:  2021-03-17       Impact factor: 2.524

  1 in total

北京卡尤迪生物科技股份有限公司 © 2022-2023.