Securing Digital Color Image based on Hybrid Substitution Cipher

This study proposes securing digital color images with hybrid substitution cryptographic methods combined with the Vigenere and Beaufort methods. The hybrid process is carried out using the help of two randomly generated keys. The first key is a matrix with an 8bits value and the second key is a matrix with a binary value. The binary key is used to determine the Vigenere or Beaufort process, while the 8-bit key is used for modulus operations based on the Vigenere or Beaufort algorithm. At the test stage used a standard image that has an RGB color channel as a dataset. The quality of the cryptographic method is measured by several measuring instruments such as MSE, PSNR, and SSIM to determine the quality of encryption visually and the perfection of decryption, besides that it is used Entropy, NPCR and UACI to determine the probability of encryption resistance and quality against differential attacks. The TIC TOC function is also used to measure the computing speed of the encryption and decryption process. Measurement results using all measuring instruments indicate that the proposed method has very satisfying results and has fast computing.


INTRODUCTION
Nowadays the digital multimedia landscape has changed due to the increasingly modern technology and many positive things but also an unexpected problem related to the security of sending multimedia data in cyberspace. Not a few cases of theft, the theft that occurs in the cyber world, so it needs special attention to data security. Cryptography is one solution that can be used to secure multimedia data [1]- [3]. Cryptography is a study that is used to secure data by encoding the data. The process of coding data will change the form that can be random or become another form that has a different meaning from the original data so that the data cannot be read directly [1], [4], [5]. The encryption process and the decryption process are the two main processes in cryptography, where encryption is used to encode data while decryption is used to return the encoded data to its original form [6].
In cryptographic research, there are many digital files that have been used as objects, where digital image files are one of the favorite objects that have been studied in various cryptographic researches today [7]- [11]. This research also focuses on digital image cryptography. In various image cryptographic research previously, chaos methods have been proposed to do scramble on images, this method is also often called permutation or diffusion method. Another method that is very favorite is the substitution method [12]. The popular algorithm in this chaotic method is Chaotic Map [13]. While the algorithms that are widely used in the substitution method are RC4, Vernam, Vigenere, Beaufort, Caesar, etc [3], [14]- [20]. In research on comparative studies of several cryptographic algorithms conducted by Setiadi et al [19], It is stated that the chaos method is superior to blueness and diffusion, but has a slower computation due to a number of iterations performed. The number of iterations plays an important role in the speed of computation, so if iterations are set up quite a lot then the performance will slow down. Another disadvantage of the chaotic method is that the image histogram does not change because the pixel value does not change only the position of the scrambled pixels. In contrast to the chaotic method, RC4 and OTP have advantages in the process of image encryption based on several measuring tools such as entropy analysis, Number of Pixel Change Rate (NPCR), unified average change in intensity (UACI), visually Structural Similarity Index (SSIM) and Peak values Signal to Noise Ratio (PSNR) refers to more random visuals. Whereas the fastest computing speed is in the OTP method.
OTP is a substitution cryptographic algorithm that is also popularly known as Vernam cipher. The XOR operator or modulo operation is the main operation in the encryption and decryption process [1]. Vernam cipher is an improvement of the Vigenere cipher algorithm, where random keys are used as the main component in encryption and decryption. Vernam's algorithm is very powerful against attacks so it is difficult to decrypt without knowing the key used. The quality of this algorithm depends on the key chosen. To get strong encryption results, the selected key must be ensured to be truly random, used only once, and guaranteed secrets. The algorithm also has simple, fast and powerful operations so that it can be continuously developed and combined to increase resistance to attacks [20]. Beaufort cipher offers a Vigenere-derived algorithm built on a subtraction operation. Both the encryption and decryption processes use subtraction operations as the main operation based on modulus operations [21]. Based on these theories, this research uses a hybrid cipher substitution method which is inspired by Vigenere and Beaufort algorithms by utilizing two random keys

LITERATURE REVIEW
Cryptography is the science of encoding data that has been used from the past until now with the aim of securing secret messages. The classic cryptographic method that is popular until now is the method of substitution, the way to change the meaning and content of messages based on the key. In the method of substitution, the quality of the key will largely determine the quality of the encryption results, the better the quality of the key, the stronger the encryption results.
One of the substitution methods that was very popular in its time was Vigenere cipher. In the early days of the encryption and decryption process utilizing the tabula recta table. This method continues to be developed, then by Gilbert Vernam, modifications are made using random keys so that the encryption results become stronger. The modification of the Vigenere cipher by Gilbert Vernam is now known as the Vernam cipher [1], [3]. The encryption formula in Vernam cipher is presented in Eq. (1) and Eq. (2) presents the decryption formula. where: is cipher image, is plain image, is key. For the note, the value of k has a range of 0-255. This value is obtained because the image pixel value is 8-bits so to get this value a modulo operation with the number 256 is performed. The popularity of the Vigenere cipher made this method developed and modified, one of the results of the modification of the Vigenere cipher was the Beaufort cipher. This method is similar to Vigenere cipher but uses a combination of subtraction and modulus techniques as the main operation, both in the encryption and decryption process [21]. In the encryption process, the subtraction is done on the key with plaintext while in the decryption process the subtraction is done on the key with the ciphertext. For more details, see formula (3) for Beaufort's encryption process and formula (4) for Beaufort's decryption.

PROPOSED METHOD
The section describes the proposed method using hybrid Vigenere and Beaufort cipher. The method will be divided into two main processes, the encryption process, and the decryption process. The stages in the encryption process are presented in Fig. 1  Get ciphered image 5. Perform encrypt using formula (5) 6. Get a ciphered image( ).
As for the stages of image decryption, see Fig.2 below.

RESULTS AND DISCUSSION
In this section, we use the 24-bit true-color image in the RGB color channel. The images used are a standard test image that can be downloaded at the SIPI image database website address [22]. Figure 3 shows the image used in this study. After all images have been downloaded, these images are used directly as a dataset to be tested and measured in the proposed method. All images taken from the website are not pre-processed, so the pixel values in the image do not change and in accordance with the original image, this is intended so that later this method will be easily compared. All images have a dimension of 512 * 512, according to the dimensions of the original image. Before the encryption process is carried out, it takes the step of making two random keys as in the third step and the fourth step of the proposed method. Figure 4 is an example of a random key generated in this study. The first random key is a gray scale image and the second random key is a binary image. By using both random keys, the encryption process is carried out by formula (1). Encrypted images are then tested for encryption quality using several gauges such as entropy, MSE, PSNR, SSIM, UACI, and NPCR. Entropy (En) is a randomness feature that is used to measure the likelihood of (p) decrypted images [7]. Entropy can be calculated by the formula (7). MSE, PSNR, and SSIM are used to measure the quality of image encryption based on errors, noise, and structural changes in the image. Formulas (8), (9), and (10), each of which is used to calculate MSE, PSNR, and SSIM. UACI and NPCR are used to measure the encryption strength of differential attacks [19,20]. Where the formula used to calculate UACI and NPCR is shown in formulas (11) and (12).
= (2 + 1 )(2 + 2 ) ( 2 + 2 + 1 )( 2 + 2 + 2 ) (10) Where is an encrypted image, is the original image, is the image width, is the image height, and is the number of layers, is the image covariance against ; 2 is a variant of image ; 2 is a variant of image ; 1 = ( 1 ) 2 ; 2 = ( 2 ) 2 ; is a dynamic range of the image(0 − 255) with the default value 1 = 0.01 and 2 = 0.03. The results of the encrypted image measurements are presented in table 1. Based on the observations of table 1, it can be seen that the entropy value produced has a nearly perfect value, which is close to 8. [19]. From these results, it was concluded that based on the entropy value of the encrypted image, it would be very difficult to do the decryption process without knowing the key used. Visually the encryption results also show very significant changes, so there is no correlation or meaning associated with the original image at all [23]. The results of MSE and PSNR measurements also emphasize the excellent quality of encryption due to the spread of errors and the amount of noise in the encrypted image. Likewise, the SSIM value is very close to zero, this means that the structure of the encrypted image really has no resemblance to the original image. In addition, the UACI and NPCR values also produce very good values, so it can be concluded that the encryption results will be resistant to various types of attacks. The computational performance of the algorithm is also measured in this research. The measuring instrument used is the tic toc function on the Matlab R2015a, which uses an AMD A12 7th Gen processor and 4GB of memory. The result, it only takes about 1.5 seconds to do the encryption process. This performance is relatively very fast and relevant if it will be implemented in a real time application.
Another test conducted in this research is histogram analysis. Histogram analysis is used to measure the strength of image encryption against statistical attacks [7], [24]. Table 2 presents the histogram of the original and encrypted images. The encrypted image histogram of all images has the same typical characteristics. On the histogram, it appears that the intensity of each pixel has a relatively uniform value. This indicates that the encryption quality is very good because the more uniform the intensity of the histogram indicates the better encryption quality [1], [19].  Figure 5 shows a sample of the results of the encryption process that has been applied to the original image. Visually, the image encryption process is very random and does not have a correlation with the original image. The next step is to test image decryption. At this stage, the perfect decryption result must be produced, ie the decryption image must be exactly the same as the original image. Measuring instruments used in the decryption stage are, MSE, PSNR and SSIM measured. In addition, computational performance is also measured using a decryption algorithm with the tic toc function in Matlab. The entire measurement results of the decryption process are shown in table 3. Based on the results presented in table 3, it can be concluded that the decryption process can be carried out properly without errors. This is proven by the value of MSE = 0, which means that there is no error in the image reconstruction process. PSNR value = inf, this means no noise enters the decrypted image. The SSIM value is also equal to 0, this indicates that there is a similarity in the structure of the encrypted image with the original image. The time needed for the decryption process is also almost the same as the extraction process, which is about 1.5 seconds.

CONCLUSION
This study proposes a hybrid substitution method using modulus operations for digital image encryption. The hybrid method is done by utilizing two random keys which also function to increase security. This method has been tested with various tests such as entropy analysis to measure image randomness, histogram analysis to measure statistical attack strength, differential attack testing using UACI and NPCR, and measurement of error, noise and structural changes in images using MSE, PSNR, and SSIM. All measurement instruments show that the proposed encryption method is of very good quality. Likewise, the decryption process can be carried out properly without errors. This method also has a calculation that is relatively simple and fast, but strong against various attacks. .