Optics Communications 387 (2017) 235–240
Contents lists available at ScienceDirect
Optics Communications journal homepage: www.elsevier.com/locate/optcom
crossmark
QR code based noise-free optical encryption and decryption of a gray scale image ⁎
Shuming Jiao, Wenbin Zou , Xia Li Shenzhen Key Lab of Advanced Telecommunication and Information Processing, College of Information Engineering, Shenzhen University, Shenzhen, Guangdong, China
A R T I C L E I N F O
A BS T RAC T
Keywords: QR code Double Random Phase Encoding Optical encryption Decryption Speckle noise Gray scale image
In optical encryption systems, speckle noise is one major challenge in obtaining high quality decrypted images. This problem can be addressed by employing a QR code based noise-free scheme. Previous works have been conducted for optically encrypting a few characters or a short expression employing QR codes. This paper proposes a practical scheme for optically encrypting and decrypting a gray-scale image based on QR codes for the first time. The proposed scheme is compatible with common QR code generators and readers. Numerical simulation results reveal the proposed method can encrypt and decrypt an input image correctly.
1. Introduction Information security is a critical issue in modern society and it is necessary to develop various data encryption schemes to prevent illegal data access from unauthorized users. In recent years, researchers investigate extensively on encryption techniques with optical means. Since an optical system has many degrees of freedom, like amplitude, phase, polarization etc., it is very difficult to reproduce the same result without knowing all the system parameters. This feature allows information encrypted in an optical system to possess a high level of security. The pioneering optical encryption work can be dated back to the Double Random Phase Encoding (DRPE) scheme proposed in 1995 [1]. Since then, the research of optical encryption has received increasingly more attention. Numerous new schemes are proposed from different aspects such as fractional Fourier transform [2], joint transform correlator [3], wavelength multiplexing [4], computational ghost imaging [5], asymmetric cryptosystem [6], space-based optical encryption [7] and lens-free DRPE in Fresnel domain [8]. In these methods, an input image can be successfully converted to be a noiselike encrypted image and the original image can be recovered only when the encryption key is known. However, there are still a number of limitations and challenges that need to be faced in the currently available optical encryption techniques [9]. Among them, speckle noise is one major obstacle for optical encryption to be widely accepted by public users. The decrypted images from optical encryption schemes are usually heavily contaminated with inherent speckle noise. As a result, the original image quality is heavily
⁎
degraded, which is not favorable for image security applications. The reason behind general speckle noise phenomenon in optical encryption is that at least one random phase mask is employed in most optical encryption schemes. For example, random phase mask can be found in all the optical encryption methods stated above [1–6,8] except spacebased optical encryption [7]. Nevertheless, the random distance shift of object image points in space-based optical encryption [7] can also generate similar speckle noise effect as random phase mask. In this paper, the optical encryption model of Double Random Phase Encoding (DRPE) in Fresnel domain [8] (illustrated in Fig. 1) is adopted to simulate and evaluate the speckle noise problem. From information security perspective, a pure DRPE scheme has been proved to be vulnerable to both known-plaintext attack [10] and cipher-text only attack [11] and it is not the most secure state-of-the-art optical encryption method. However, DRPE is a fundamental random phase mask based optical encryption scheme that numerous more advanced methods are built on upon. The study on speckle noise effect due to random phase mask in DRPE model is representative and can be generalized to many other schemes. On the other hand, some speckle noise reduction methods in optical encryption have been proposed such as capturing multiple images with changing random phase masks [9], fully phase encryption [12], thresholding of encrypted image [13]. However, the speckle noise can only be suppressed to certain extent instead of being fully removed. Recently, quick-response (QR) code is introduced to optical encryption schemes as speckle noise data containers [14]. A QR code pattern has strong fault tolerance and error correction capability. The
Corresponding author. E-mail address:
[email protected] (W. Zou).
http://dx.doi.org/10.1016/j.optcom.2016.11.066 Received 21 September 2016; Received in revised form 19 November 2016; Accepted 23 November 2016 0030-4018/ © 2016 Elsevier B.V. All rights reserved.
Optics Communications 387 (2017) 235–240
S. Jiao et al.
Table 1 Rules for the Conversion between Binary Sequence and Decimal Sequence in Proposed Scheme. Step 1 Step 2
Fetch four binary bits. If the four digits are 1000 or 1001, Convert it to 8 or 9 and start Step 1 again from the next digit immediately after the four digits. If the four digits are neither 1000 nor 1001, Fetch first three digits instead and convert it to one of the numbers between 0 and 7. Go to Step 1 starting from the next digit immediately after the three digits.
Fig. 1. Optical setup of Fresnel domain DRPE encryption system.
For a gray-scale image, the common data format is BMP or JPEG [21]. In BMP format image, each image pixel is represented by 8 binary bits. JPEG is a compressed version of BMP image and it contains a smaller number of bits in total compared to a BMP image. The binary data in either a BMP file or a JPEG file can be directly read out and cascaded as a single long binary number sequence. In the next step, the binary number sequence is converted to be a decimal integer sequence. The rule is as follows. First, decimal number 0–7 is corresponding to a three-digit binary sequence, for example, 0 corresponds to “000” and 7 corresponds to “111”. Decimal number 8 and 9 corresponds to four-digit binary sequence “1000” and “1001”. Second, the conversion is proceeded based on the following procedures, shown in Table 1. An example of the mutual conversion between the decimal sequence and binary sequence is illustrated in Fig. 2(a). There is a maximum data storage limit for one single QR code, depending on the QR code version (code size). For example, a version 1 QR code (size: 21×21 dots) with low level error correction can store at most 41 decimal integer numbers, a version 6 QR code (size: 41×41 dots) with low level error correction can store at most 322 decimal integer numbers, and a version 11 QR code (size: 61×61 dots) with low level error correction can store at most 772 decimal integer numbers. The length of decimal sequence representing the gray scale image can often exceed the maximum data capacity of one single QR code. As a result, it is necessary to cut the decimal sequence into a number of segments and each segment is employed to generate an individual QR code. The gray scale image is therefore represented by multiple QR codes. As stated above, the generation of QR codes are under numeric mode. The generated QR codes will go through optical encryption/ decryption procedures in different schemes such as the one illustrated in Fig. 1. When the decrypted QR codes are obtained, they can be read by any conventional QR code reader and the integer sequence can be retrieved from each code. Multiple integer sequences can be assembled into one integer sequence, which will be later transformed into a binary sequence based on an opposite way of the rules stated in Table 1 and Fig. 2(a). Finally, the binary sequence is converted back to an image file representing the final decrypted image. The entire conversion, encryption and decryption scheme can be summarized in Fig. 2(b).
stored data in a QR code can be correctly retrieved by a reader such as a smart phone under noisy environment. Experimental results reveal that, if the input message is converted to a QR code with adequate image resolution first and then the QR code follows encryption and decryption stages in double random phase optical encryption scheme, the final retrieved message from QR code can be completely noise free [14]. A number of subsequent research works has been conducted to improve the performance of QR code based optical encryption scheme [15–17]. The QR code based noise-free optical encryption scheme can be combined with optical information authentication [18] and computational ghost imaging [19] to obtain enhanced security level. Despite the success, we notice that, in all previous works [14–19], only a few characters or a short expression are encrypted and decrypted. However, the most common type of data in general optical encryption and decryption systems is gray scale image. No attempt has been made on processing a gray-scale image in a QR code based optical encryption scheme. In addition, most commercial QR code readers do not support the function of reading an image directly from a QR code. In fact, the mutual conversion between an image and QR codes is not included as one part in the QR code standard [20]. In this paper, we propose a practical mutual conversion scheme between gray scale image and QR codes in optical encryption systems. This scheme is compatible with commonly used QR code generator and readers. We demonstrate for the first time how a gray scale image can be converted to QR codes, subsequently encrypted optically, and finally recovered from the decrypted QR codes.
2. Proposed QR code based noise-free optical encryption scheme for a gray scale image The Quick Response Code (QR Code), defined by ISO/IEC18004 international standard [20], is a popular scheme for embedding moderate amount of information in a 2D code pattern. QR code has numerous applications in manufacturing, sales, logistics, storage, transportation and consumer product industry. A QR code pattern consists of black and white square dots as the basic binary information units. The number of dots, or the QR code size, varies with different QR code versions [20] and it is proportional to the amount of information stored in the code. The minimum size can be 21×21 and maximum size can be 177×177. According to the coding standard [20], a QR code generator/reader usually accept four types of input data: numeric mode (0–9 integer numbers), alphanumeric mode (0–9 integer numbers, uppercase letters and some symbols), byte mode (for European characters) and Kanji (Kanji characters). It is evident that the four types of data are all designed for texts and characters and an image cannot be directly transformed to a QR code. In order to be compatible with common QR code generators and readers, it is feasible to convert an image into one of the text character modes first. In this paper, the simplest mode, numeric mode is adopted. A gray scale image is converted to a long binary sequence and the binary sequence is subsequently converted to a decimal integer sequence.
3. Numerical simulation results and discussion 3.1. Numerical simulation In our numerical simulation, a gray scale (32×32 pixels) image, shown in Fig. 6(a), is encrypted and decrypted through a QR code based noise-free DRPE optical encryption system. The DRPE system in Fresnel domain [8] (illustrated in Fig. 1.) is adopted and the encryption and decryption process can be described by Eqs. (1) and (2) respectively.
236
g(x, y)=FrT{FrT[f(x, y)exp(jφ1 (x, y)), z1]exp(jφ2 (x, y)), z2}
(1)
u(x, y)=|FrT[FrT(g* (x, y), z2 )exp(jφ2 (x, y)), z1] |
(2)
Optics Communications 387 (2017) 235–240
S. Jiao et al.
Fig. 2. (a) An example illustrating the conversion between binary sequence and decimal sequence in proposed scheme; (b) Flow chart of the entire QR code based noise-free optical encryption and decryption scheme for a gray scale image.
where FrT refers to a Fresnel transform, φ1 (x, y) and φ2 (x, y) are the two random phase masks, f(x, y) is the original image, g(x, y) is the encrypted image (g* (x, y)is the conjugate ) and u(x, y) is the decrypted image. The two propagation distances z1 and z2 are both set to be 0.1 m in our simulation. The optical wavelength is 650 nm and the pixel size is 0.7 µm. The grayscale image is in JPEG format and has a binary data file size of 684 bytes. The image can be represented by a binary number sequence of 5472 bits. Then this binary number sequence can be converted to a decimal number sequence of 1752 integers. After that, the decimal number sequence is divided into 6 segments with 300 numbers in each segment (252 numbers in the last one). The first segment is illustrated as an example in Fig. 3 (subsequently transformed to Fig. 4(a)). Each segment is converted to a QR code (version 6 QR code of size 41×41 dots) in numeric mode, which can be done by
Fig. 3. First segment of the decimal sequence representing original image.
237
Optics Communications 387 (2017) 235–240
S. Jiao et al.
Fig. 5. (a)–(f) Decrypted QR codes after DRPE optical encryption and decryption.
Fig. 4. (a)–(f) QR codes generated from the six segments of decimal sequence.
any QR code generator. The six QR codes are illustrated in Fig. 4(a)– (f). After the QR codes go through the encryption and decryption process, the final decrypted QR codes are shown in Fig. 5(a)–(f). It can be observed that the QR codes are contaminated with speckle noise. However, due to the noise resistant capability, all the decimal numbers stored in the QR codes can be still be correctly retrieved by conventional QR code readers. In this paper, the Samsung QR code reader program installed on Samsung galaxy S5 smart phone is employed for the information retrieval. Then the six segments are assembled again into one decimal number sequence. After the decimal number is converted back to a binary sequence, and subsequently converted back to a binary file, the original image can be recovered, shown in Fig. 6(c). Compared with the decrypted image from the same DRPE system without employing QR codes as data containers, shown in Fig. 6(b), the result from QR code based noise-free scheme has a substantially better performance in terms of recovered image quality. It can be observed that the result in Fig. 6(b) is heavily contaminated with speckle noise but the result in Fig. 6(c) is the same as the original image in Fig. 6(a). In Fig. 6, it shall be noted that Fig. 6(a), Fig. 6(b) and Fig. 6(c) are all enlarged from original size in this paper for better illustration. Another example of original image, decrypted image with noise contamination and decrypted noise-free image (size 256×256) with our proposed method is shown in Fig. 7.
Fig. 6. (a) Original 32×32 Gy-scale image; (b) Decrypted image from DRPE optical system without employing QR codes for Fig. 6. (a); (c) Decrypted image from DRPE optical system with employing QR codes Fig. 6 (a).
Due to the error correction mechanism in QR code encoding, most readers will either retrieve all information correctly from the QR code or identify the QR code as “unrecognized”. It seldom occurs that partially correct and partially wrong information is retrieved from a QR code. As a consequence, the final reconstructed image will be fully identical to the original one as long as all the QR codes are successfully recognized by the QR code reader. Theoretically there is no upper limit on the amount of information that our proposed scheme can encrypt and decrypt. An original image with larger size will merely require more QR codes to be employed for encoding. In Table 2, the number of QR codes (different versions) required to represent one gray scale image (different sizes) is demonstrated. Since a higher version QR code has denser dots in the pattern and a larger data storage capacity, the number of QR codes representing the same gray-level image can be reduced by employing higher version QR codes. However, in a practical optical imaging system, the
3.2. Discussion In fact, each pixel value in Fig. 6(c) is exactly the same as Fig. 6(a). 238
Optics Communications 387 (2017) 235–240
S. Jiao et al.
Fig. 7. (a) Original 256×256 Gy-scale image; (b) Decrypted image from DRPE optical system without employing QR codes for Fig. 7(a); (c) Decrypted image from DRPE optical system with employing QR codes Fig. 7(a). Table 2 Number of QR Codes Required to Represent One Gray Scale Image in Various Situations. Gray-scale image
Length of decimal number sequence
No. of V3 QR codes (29×29)
No. of V6 QR codes (41×41)
No. of V10 QR codes (57×57)
No. of V30 QR codes (137×137)
A 32×32 JPEG image with file size 684 Bytes A 64×64 JPEG image with file size 3080 Bytes A 128×128 JPEG image with file size 8871 Bytes A 256×256 JPEG image with file size 26,858 Bytes
1752
14
6
3
1
7875
63
25
13
2
22,768
180
71
35
6
68,896
543
214
106
17
noise-free scheme. In this paper, a practical protocol, compatible with common QR code generators and readers, is proposed for optically encrypting and decrypting a gray-scale image employing QR codes. A gray-scale image is transformed to a decimal number sequence and the decimal number sequence can be converted to multiple QR codes. The entire process of encrypting and decrypting a 32×32 Gy-scale image by our proposed method is demonstrated through a numerical simulation. The results indicate that a gray-scale image can be encrypted successfully and finally recovered in a noise-free manner with proposed method. In addition to gray-scale images, the optical encryption and decryption of movies and other multimedia signals based on QR codes can be explored in future works.
imaging size for an QR pattern image is limited and a higher version QR code will bring a lower resolution. For example, it is assumed that the image pixel size of QR code pattern is limited to 200×200 in a system, if V3 QR code is employed, the size of for each dot can be more than 6×6 (200 divided by 29) pixels; if V6 QR code is employed, the size of each dot will be reduced to around 5×5 pixels, which is more difficult to be successfully recognized; if V10 QR code is employed, the size of each dot will be only be 1×1 or 2×2 pixels, which is not recognizable by conventional readers in very noisy background. As a consequence, though V10 QR code is more efficient (number of codes is reduced), successful decryption cannot be achieved. It can be inferred that if the imaging size in optical system and the number of QR code patterns can be used are both restricted, then there will be an upper limit for the amount of information that can be encrypted and decrypted, which equals to the maximum information capacity of each QR code, multiplied by the number of QR codes. From Table 2, it is evident that multiple QR codes or even dozens of QR codes are required to represent one gray-scale image. The efficiency of encrypting and decrypting a large number of QR code pattern images optically becomes a significant problem in practical applications. This challenge can be tackled by the unique property of optical encryption that an optical system possesses many complex degrees of freedom and allows a large amount of information to be processed efficiently in parallel. A large number of QR code images can be processed simultaneously in a multiplexing manner by different angles of reference waves [22], different wavelengths [4,23], different spatial positions [24], multiplane phase retrieval [25], theta modulation gratings [26], different polarized light [27] and other varying optical parameters.
Funding This work was supported in part by the National Natural Science Foundation of China [Grant number 61401287]; and in part by the Natural Science Foundation of Shenzhen under Grant [Grant numbers JCYJ20160307154003475, JCYJ2016050617265125]. References [1] R. Philippe, B. Javidi, Optical image encryption based on input plane and Fourier plane random encoding, Opt. Lett. 20 (7) (1995) 767–769. [2] G. Unnikrishnan, J. Joseph, K. Singh, Optical encryption by double-random phase encoding in the fractional Fourier domain, Opt. Lett. 25 (12) (2000) 887–889. [3] N. Takanori, B. Javidi, Optical encryption using a joint transform correlator architecture, Opt. Eng. 39 (8) (2000) 2031–2035. [4] L. Chen, D. Zhao, Optical color image encryption by wavelength multiplexing and lensless Fresnel transform holograms, Opt. Express 14 (19) (2006) 8552–8560. [5] P. Clemente, V. Durán, E. Tajahuerce, J. Lancis, Optical encryption based on computational ghost imaging, Opt. Lett. 35 (14) (2000) 2391–2393. [6] W. Qin, X. Peng, Asymmetric cryptosystem based on phase-truncated Fourier transforms, Opt. Lett. 35 (2) (2000) 118–120. [7] W. Chen, X. Chen, Space-based optical image encryption, Opt. Express 18 (26) (2010) 27095–27104. [8] G. Situ, J. Zhang, Double random-phase encoding in the Fresnel domain, Opt. Lett. 29 (14) (2004) 1584–1586. [9] B. Javidi, A. Carnicer, M. Yamaguchi, T. Nomura, E. Pérez-Cabré, M.S. Millán, N.K. Nishchal, R. Torroba, J.F. Barrera, W. He, X. Peng, A. Stern, Y. Rivenson, A. Alfalou, C. Brosseau, C. Guo, J.T. Sheridan, G. Situ, M. Naruse, T. Matsumoto,
4. Conclusion In conclusion, speckle noise is one major challenge in obtaining high quality decrypted images in optical encryption. QR code can be employed as a “data container” to resist speckle noise and a noise-free decrypted result can be achieved. However, in the past, only a few characters or a short expression are attempted in the QR code based 239
Optics Communications 387 (2017) 235–240
S. Jiao et al.
[10] [11]
[12] [13]
[14] [15] [16]
[17]
[18]
I. Juvells, E. Tajahuerce, J. Lancis, W. Chen, X. Chen, P.W.H. Pinkse, A.P. Mosk, A. Markman, Roadmap on optical security, J. Opt. 18 (8) (2016) 083001. X. Peng, P. Zhang, H. Wei, B. Yu, Known-plaintext attack on optical encryption based on double random phase keys, Opt. Lett. 31 (8) (2016) 1044–1046. X. Liu, J. Wu, W. He, M. Liao, C. Zhang, X. Peng, Vulnerability to ciphertext-only attack of optical encryption scheme based on double random phase encoding, Opt. Express 23 (15) (2015) 18955–18968. N. Towghi, B. Javidi, Z. Luo, Fully phase encrypted image processor, J. Opt. Soc. Am. A 16 (8) (1999) 1915–1927. B. Javidi, N. Towghi, N. Maghzi, S.C. Verrall, Error-reduction techniques and error analysis for fully phase- and amplitude-based encryption, Appl. Opt. 39 (23) (2000) 4117–4130. J.F. Barrera, A. Mira, R. Torroba, Optical encryption and QR codes: secure and noise-free information retrieval, Opt. Express 21 (5) (2013) 5373–5378. J.F. Barrera, A. Mira, R. Torroba, Experimental QR code optical encryption: noisefree data recovering, Opt. Lett. 39 (10) (2014) 3074–3077. J.F. Barrera, A. Vélez, R. Torroba, Experimental scrambling and noise reduction applied to the optical encryption of QR codes, Opt. Express 22 (17) (2014) 20268–20277. S. Trejos, J.F. Barrera, R. Torroba, Optimized and secure technique for multiplexing QR code images of single characters: application to noiseless messages retrieval, J. Opt. 17 (8) (2015) 085702. X. Wang, W. Chen, X. Chen, Optical information authentication using compressed
[19]
[20]
[21] [22] [23] [24] [25]
[26] [27]
240
double-random-phase-encoded images and quick-response codes, Opt. Express 23 (5) (2015) 6239–6253. S. Zhao, L. Wang, W. Liang, W. Cheng, L. Gong, High performance optical encryption based on computational ghost imaging with QR code and compressive sensing technique, Opt. Commun. 353 (2015) 90–95. International Standard ISO/IEC 18004, Information technology – automatic identification and data capture techniques – QR Code 2005 bar code symbology specification, Second Edition, 2006. R.C.Gonzalez, E.Richard, Digital Image Processing, Nueva Jersey, 2008. R. Henao, E. Rueda, J.F. Barrera, R. Torroba, Noise-free recovery of optodigital encrypted and multiplexed images, Opt. Lett. 35 (3) (2010) 333–335. G. Situ, J. Zhang, Multiple-image encryption by wavelength multiplexing, Opt. Lett. 30 (11) (2005) 1306–1308. G. Situ, J. Zhang, Position multiplexing for multiple-image encryption, J. Opt. A – Pure Appl. Opt. 8 (5) (2006) 391. H.E. Hwang, H.T. Chang, W.N. Lie, Multiple-image encryption and multiplexing using a modified Gerchberg-Saxton algorithm and phase modulation in Fresneltransform domain, Opt. Lett. 34 (24) (2009) 3917–3919. F. Mosso, J.F. Barrera, M. Tebaldi, N. Bolognini, R. Torroba, All-optical encrypted movie, Opt. Express 19 (6) (2011) 5706–5712. J.F. Barrera, R. Henao, M. Tebaldi, R. Torroba, N. Bolognini, Multiplexing encrypted data by using polarized light, Opt. Commun. 260 (1) (2006) 109–112.