Encryption and Decryption of Color Images through Random Disruption of Rows and Columns

2020-09-23 02:39ZENGJianhua曾建华ZHANYanlin占炎林YANGJianrong杨建荣
关键词:建华

ZENG Jianhua(曾建华),ZHAN Yanlin(占炎林),YANG Jianrong(杨建荣)

School of Physics and Electronic Information,Shangrao Normal University,Shangrao 334001,China

Abstract: In modern society,information is becoming increasingly interconnected through networks,and the rapid development of information technology has caused people to pay more attention to the encryption and the protection of information. Image encryption technology is a key technology for ensuring the security performance of images. We extracted single channel RGB component images from a color image using MATLAB programs,encrypted and decrypted the color images by randomly disrupting rows,columns and regions of the image. Combined with histograms and the visual judgments of encryption images,it is shown that the information of the original image cannot be obtained from the encryption image easily. The results show that the color-image encryptions with the algorithm we used have good effect and fast operation speed. Thus this algorithm has certain practical value.

Key words: color image; encryption; decryption; single channel RGB component image; disrupting

Introduction

With the rapid innovation of science and technology in 21stcentury,such as cloud technology,big data and the internet of things,information security is facing an arduous challenge. Effectively protecting images and texts which are transmitted on the internet has become an issue that cannot be ignored. Image encryption technology is a key technology for ensuring image security performance. Digital image encryption originates from the early classical encryption theory,in which the objective is to transform an image into a chaotic image in the spatial and frequency domains according to specified transformation rules,thereby hiding the true information of the image to protect the original.

People have a strong interest in optical image encryption technology,and researchers have proposed many encryption methods. In 1995,the method of image encryption,which used double-random phase coding in the 4-f system,was first proposed by Refregier and Javidi[1]; since then,the research group has proposed various improved optical image encryption methods[2-11]. Researchers[12-17]proposed the concept of a virtual optical encryption system and a variety of new and improved optical encryption systems. In 2003,Suzukietal.[18]proposed a scheme for fingerprint authentication that is based on the optical image encryption system. In 2004,Hennelly and Sheridan[19]proposed an encryption scheme that used a random phase and jigsaw manipulation in the Fresnel domain. In 2006,Fredy Barreraetal.[20]proposed a scheme for multiple repeated encryption and decryption operations via the phase shift of a random phase plate. In 2008,Zhu and Zhang[21]proposed a mixed-image-element encryption algorithm based on an elliptic curve cryptosystem. In 2009,Singh and Sinha[22]proposed an optical encryption method based on the gyrator transform,and Alfalou and Mansour[23]developed the multireuse and multi-image encryption using the double-random encryption method. In 2010,Clementeetal.[24]demonstrated a ghost imaging encryption process. In 2012,Wang and Zhao[25]proposed a photoelectric image encryption and decryption technology based on the coherent superposition principle and digital holography. Keshari and Modani[26]proposed an image encryption technique for color images which used the conventional logarithm operator,a chaotic map and the four-weighted fractional Fourier transform. In 2013,Liuetal.[27]proposed an optical encryption technique based on chaos and computational holography. Lietal.[28]proposed an image encryption/decryption algorithm based on a chaotic control parameter and a hyperchaotic system with a composite permutation-diffusion structure. In 2014,based on compression perception and dual-random phase encryption technology,Deepanetal.[29]proposed a scheme for multiple image encryption that used space multiple reuse,and Wangetal.[30]proposed a dual-color image encryption method for realizing the single-channel dual-color image encryption on the basis of the fractional Fourier transform. In 2015,Maluendaetal.[31]proposed an optical image encryption method based on photon counting polarization imaging,and Rawatetal.[32]proposed a multispectral double image encryption scheme based on the compression perception algorithm. In 2016,Wangetal.[33]proposed an asymmetric encryption scheme based on an improved amplitude phase recovery algorithm. In 2017,Xietal.[34]proposed an image encryption method using diffraction imaging technology. In 2018,Chenetal.[35]proposed a compressive sensing and encryption algorithm for image encryption and compression based on a sequence,Liuetal.[36]designed and implemented color image encryption based on qubit rotation about the axis,Zhangetal.[37]actualized multiple image encryption based on double-random phase encoding and compressive sensing by using a measurement array preprocessed with orthogonal-basis matrices,and Annabyetal.[38]accomplished color-image encryption using random transforms,phase retrieval,chaotic maps and diffusion. In 2019,Kumar and Quan[39]used the spiral phase transformation and chaotic pixel technology to encrypt optical color images,Lietal.[40]proposed a color image encryption scheme through combining the DNA sequence operation based on the chaotic system,and Firdousetal.[41]presented an innovative and highly efficient color image encryption technique based on the concept of linear transformation.

At present,some encryption algorithms are complicated. There are certain requirements for the image format,and the encryption effect of some algorithms for the stripe color image is poor. Therefore,it is necessary to explore encryption and decryption algorithms of the color image which are simple and can be widely used. There are many kinds of algorithms for color image encryption,among which the optical system of multi-channel color image encryption algorithm needs many sets of optical elements,the experiment is difficult,the cost is high,and the practicability is not strong. The operation speed of the random pixel-disrupting algorithm is slow because of the large number of elements in a true color image matrix. In order to explore a better color image encryption algorithm,we extracted a single channel RGB component of a color image using MATLAB programs and realized encryption and decryption of the color image by randomly disrupting rows,columns and regions of the image,and achieved an ideal encryption effect.

1 Methods

A color image is a three-dimensional matrix that is formed by the superposition of three two-dimensional matrices. The first layer of the three-dimensional matrix is a red two-dimensional data matrix,the second layer is a green two-dimensional data matrix,and the third layer is a blue two-dimensional data matrix. The data of RGB component colors in the same position are superimposed to form colors and the whole color image can be formed via the superposition of the data in all positions.

1.1 Encryption of images in cryptography

Cryptography is a technical science in which compilation and deciphering of passwords are studied. A law of public-secret transformation in cryptography is termed as a password system and the parameters that specify this transformation are termed as keys. The objective of encryption is to ensure that the secrecy of the information is maintained during transmission. Currently,information is transmitted fast and maintaining information security poses a substantial problem. Therefore,it is important to encrypt information. Figure 1 shows a flow diagram of encryption and decryption.

Fig. 1 Flow diagram of encryption and decryption

1.2 Encryption via random disruption of rows or columns of each layer

In our study,we performed image encryption and decryption through five MATLAB programs which were displayed in Appendix. Decryption is the inverse transformation process of encryption,and each program contains both encryption and decryption codes. After the program is run,encryption and decryption results can be obtained at the same time.

Encryption via disrupting matrix rows or columns involves few steps. It is fast,and can be applied to larger image files. Its main disadvantage is that it cannot encrypt a horizontally or vertically striped image. Taking the random disruption of rows as an example,we introduce encryption and decryption methods. The image is read into a RGB matrix using the imread function,which we assume is anm-row,n-column and three-layer matrixA(:,:,1),A(:,:,2) andA(:,:,3),the matrixFof each layer is

Each pixel in a digital image is the corresponding element in the matrix. Random vectors can be produced by the randsample function. We can use the randsample function to generate a random sequence of integers:

{8,5,1,12,6,3,2,… ,m}.

(2)

The random sequence of integers corresponds to themth row of the image RGB matrix and returns the vectorr. Via this approach,the rows of the original image matrix can be randomly disrupted. For example,the 8th row of the original image matrix can be changed to the 1st row,and the 5th row of the original image matrix can be changed to the 2nd row. The disturbed matrix is returned to RGBs,and the locations of elements 1 tomin vectorrare obtained using the find function; the locations are returned to the vectorfso that the disturbed image can be restored. The encryption and decryption process via the random disruption of rows is shown in Fig. 2.

Fig. 2 Flow diagram of encryption and decryption by the random disruption of rows

According to the image encryption and decryption flow,we applied the MATLAB programs for randomly disrupting rows and columns of RGB component images and realized encryption and decryption of the color image. Because the disruptions are random,a different encrypted image will be obtained each time when the program is executed.

2 Results and Discussion

We realized encryption and decryption of color images by randomly disrupting rows and columns in RGB component images.

2.1 Color image by deleting red,green or blue component

By running the MATLAB program (1) in Appendix,we studied the change in the color image after one color component was deleted,as shown in Fig. 3. The results demonstrate a color difference between the obtained image and the original image after one color component was deleted. The complementary color of images with deleted components is shown in Figs. 3(b)-(d). However,the morphology and the information in the original image can still be distinguished from those of the images after color component deletion.

Fig. 3 Images by deleting different color components: (a) original image; (b) image after deletion of red component; (c) image after deletion of green component; (d) image after deletion of blue component

2.2 Encryption and decryption via random disruption of rows at each layer of a color image

By running the MATLAB program (2) in Appendix,we extracted single channel RGB component images of the color image and disrupted the rows of the color component images to realize encryption and decryption. In Fig. 4(a),both green and blue components are hidden. The encryption of the image is completed and it is not possible to see the information of the original image. Then,by inverting the encrypted image,decryption can be realized. In Fig. 4(b),both red and blue components are hidden. In Fig. 4(c),both red and green components are hidden. The encrypted images of the three color components exhibit positive characteristics. The rows of three color component images are completely disrupted and synthesized on an image to implement the encryption. Then,the decrypted image can be obtained via inverse transformation. The results are shown in Figs. 4(d) and (h),which demonstrate that this method has satisfied encryption performance and the original colors of three color components are exhibited in the encrypted image. In a word,any information of the original image can not be seen from the image disrupted by this algorithm in Fig. 4,and the encryption effect is very good. The information of the original image can be decrypted successfully through inverse transformation and restoration,as shown in Figs. 4(e) - (h).

Fig. 4 Encryption and decryption results after randomly disrupting rows in each layer of a color image: (a) encrypted image and (e) decrypted image for encryption of red component image; (b) encrypted image and (f) decrypted image for encryption of green component image; (c) encrypted image and (g) decrypted image for encryption of blue component image; (d) encrypted image and (h) decrypted image for the encryption via simultaneously disrupting rows of red,green and blue components

2.3 Encryption and decryption via random disruption of columns at each layer of a color image

By running the MATLAB program (3) in Appendix,after extracting single channel RGB component images of the color image,we also disrupted columns of the color component image to achieve encryption and decryption. In Fig. 5(a),green and blue components are hidden. Then,by inverting the encrypted image,decryption can be realized. In Fig. 5(b),red and blue components are hidden. In Fig. 5(c),red and green components are hidden. The columns of three color component images are completely disrupted and synthesized on an image to implement the encryption. Then,the decrypted image can be obtained via inverse transformation,and the results are shown in Figs. 5(d) and (h),which demonstrate that this method also obtains satisfied encryption performance by disrupting columns of three color component images. It can be seen from Fig. 5 that the encryption image can not show any information of the original image,which shows a good encryption effect. The information of the original image can be decrypted and obtained successfully by inverse transformation.

Fig. 5 Encryption and decryption results after randomly disrupting columns at each layer of a color image: (a) encrypted image and (e) decrypted image for encryption of red component image; (b) encrypted image and (f) decrypted image for encryption of green component image; (c) encrypted image and (g) decrypted image for encryption of blue component image; (d) encrypted image and (h) decrypted image for encryption via the simultaneous disruption of columns of red,green and blue components

2.4 Encryption and decryption by randomly and simultaneously disrupting rows and columns at each layer of a color image

We randomly disrupted rows and columns of color component images by running MATLAB program (4) in Appendix and performed image encryption and decryption. In Fig. 6(a),green and blue components are hidden. Then,by inverting the encrypted image,decryption can be realized. In Fig. 6(b),red and blue components are hidden. In Fig. 6(c),red and green components are hidden. Encryption of images with three color components yields satisfied results. The rows and columns of images with three color components are completely disrupted and synthesized on an image to implement the encryption. Then,the decrypted image can also be obtained via inverse transformation. The results are shown in Figs. 6(d) and (h); the color visual effect of the encrypted image is enhanced in Fig. 6(d). In summary,this method has satisfied encryption performance. The information of the original image can be decrypted and obtained successfully by inverse transformation.

Fig. 6 Encryption and decryption results after randomly disrupting rows and columns at each layer of a color image: (a) encrypted image and (e) decrypted image for encryption of red component image; (b) encrypted image and (f) decrypted image for encryption of green component image; (c) encrypted image and (g) decrypted image for encryption of blue component image; (d) encrypted image and (h) decrypted image for the encryption that is obtained by simultaneously disrupting rows and columns of red,green,and blue components

2.5 Encryption and decryption by randomly disrupting different regions of a color image

A new image will be formed by randomly disrupting regions of the image with three color components. After randomly disrupting regions of the component images by running the MATLAB program (5) in Appendix,the color image becomes ambiguous,as shown in Fig. 7(a). This is because when three color component images are extracted,the corresponding images can be obtained. However,after reassembly,images at the three points of the component images are spliced together and the image will become blurred after the superposition,which has an encryption effect. Decryption can be realized by retrieving the original image,and the information of the original image can be obtained,as shown in Fig. 7(b).

Fig. 7 Encryption and decryption results after randomly disrupting regions of a color image: (a) encrypted image; (b) and decrypted image

2.6 Analysis of image encryption effect by histograms

The histogram of the image reflects the distribution of the image’s gray values,and we captures the histograms of various images by running MATLAB program (6) in Appendix,as shown in Fig. 8. For the red component image,histograms of three encrypted images and itself are identical,as shown in Fig. 8(b). For green and blue component images,the same results are exhibited,as shown in Figs. 8(c) and (d). This is because after disrupting rows and columns of component images randomly,the distribution of the image’s gray values has not changed. On account of weaker equilibrium of the histograms in Figs. 8(b) - (f),it is not enough to resist statistical attack,but these histograms show different distributions of gray values compared with the histogram of the original image in Fig. 8(a). It indicates that it is not easy to get the information of the original image from these encrypted images. In a word,by analyzing histograms and observing encryption images intuitively,it can be determined that the image encryption effect of the algorithm we used is good. In addition,the running speed is also relatively fast.

Fig. 8 Histograms of color images: (a) original image; (b) red component image and its encryption images; (c) green component image and its encryption image; (d) blue component image and its encryption image; (e) encrypted image after simultaneously disrupting rows and columns of the color image; (f) encrypted image after randomly disrupting regions of the color image (the inset shows the image corresponding to the histogram)

3 Conclusions

To protect the security of image information effectively,we explore encryption and decryption of color images by running MATLAB programs. First,we extracted single channel RGB component images of color images. Then,we encrypted and decrypted the color images by randomly or simultaneously disrupting rows or columns of each image,which yielded a satisfied encryption performance. Finally,the images were blurred by randomly disrupting different regions and the encryption was realized. The algorithm has a good encryption effect and practical value,which helps to enrich the methods of image encryption.

猜你喜欢
建华
倒立奇奇
变来变去的树
托尼逃跑
米沙在书里
可怕的事
哈比的愿望
100岁的贝其
艾米狗
一半河马
变变变