Image encryption based on pixel bit modification

There are currently some publications about image encoding without changing pixel values. One of them encodes the image by dividing the image into blocks and then creating permutations and combinations into block positions. The disadvantage of this method is a grayscale histogram of an encoding image similar to a grayscale histogram of a plain image. This happens because the number of grayscale for the light intensity of the plain image is the same as the grayscale for the light intensity of the encoded image. In this article we propose image encoding by manipulating pixel bits. The result of this research is an image coding method where plain images and encoded images have big differences on grayscale histogram and visual.


Introduction
Nowadays, researchers about image encoding more focused on several aspects of which: [1] make permutations on some parts of the image, [5] transpose some parts of the image, [2] make combination on some parts of the image, [6] encode the image using affine transformations. [4] Some publications introduce an image encoding method by randomizing the position of pixels. [2] The position of pixels is randomized using permutation and combination processes. [5] divides the image into blocks, then the block position is scrambled to encode the image. [3] Scramble the pixel position on each layer of the colored image.
Image encoding performed by [2,5,10] produces a good visual encoding image but the weakness of this method is the greyscale histogram of plain and encoded images having the same shape because the number and pixel values are unchanged for the image before and after encoding. This weakness will be used by hackers as the entrance to destroy or manipulate the existing images. In statistical analysis, the difference between the plain image and the encrypt image can be seen from the mean sequare error (MSE) value, coeficient corelation, dan peak signal noise relation (PSNR). In this article we offer an image encoding method by modifying its pixel value. We will manipulate the pixel value by redeeming between least significant bits (MSB) and least significant bits (LSB) in each pixel. The result of this method, the original image and the coded image have a significant difference both visually and from the histogram form. This happens because the number of grayscale of plain image and encrypt image is different, although the pixel position is no different.

Digital Image
Image data and text data is very different because an image contains very large data, and all data are interconnected one and the other. The image data also contains considerable data repetition [7]. The concept of the difference between text data and image data can be shown in the table below.
P1 and P2 are completely different, but visually they look similiar A digital image consists of a number of elements, each element occupying a certain position and has a value. This element is usually called the picture element or pixel. [8]. An image is defined as a twodimensional function f(x, y) where x and y are coordinate pairs. The value of f(x, y) is the light intensity of pixels in coordinates (x,y) and usually it's called grayscale. The value of a pixel can be converted to 8 binary digits (bits). From the results of correlation coefficient analysis found that if the value of ‫ܥܥ‬ smaller then it is said that the results of coding is better. If ‫ܥܥ‬ = 1 it is said both identical image or encoding fail. If ‫ܥܥ‬ = 0 it's said the two images are perfectly different.The correlation of image is the relationship between pixel pairs that are adjacent to each other vertically, horizontally or diagonally [1].

Image Encryption Algorithm by Pixel Modification
In this article we propose an image coding method based on pixel modification. The modification of the pixels that we propose is the exchange between the most significant bits (MSB) and least significant bits (LSB). Because of the type of this image encoding is symmetry, so the encryption procedure as same as the decryption procedure. The following is the proposed image encoding algorithm: 1. Enter the initial image with the known pixel value 2. Convert the pixel value to 8 bits.

End
The above algorithm applies to encoding and decoding process. The algorithm of this method can be presented in the following flowchart form: = bit to k of pixel on the position (i,j) For example, if known pixel data as follows: Based on the example above, we know that to encode an image only need to exchange between most significant bits (MSB) and least significant bits (LSB). This method is used for encryption or decryption of an image, so it is symmetry cryptography.

Results and Discussion
To test this algorithm, we do an experiment . This test is performed using a laptop with the I3 core microprocessor specification and Microsoft Windows 10 operating system .Program written using MATLAB R2016b and good quality image as the data. The results of this algorithm can be shown in the figure below. We use balloon images as data and histogram of grayscale for comparison (a) (b)  From the visualization results, the image 3a and image 4a above show that the image encoding results are very difficult to interpretation. We can see that density of histogram plain image(figure.3b) is greater than the density of histogram encrypt image (figure.4b). It shows that there is a significant difference between the original image and image of the encoding. In the histogram of figure 3b and 4b above shows that the intensity of the encrypt image as not same as the plain image, it cause the image to be more bad. In addition to analyzing the histogram, we also analyze the correlation between adjacent pixels, by vertically,horizontally and diagonally. Here we choose 2000 pairs of adjacent pixels and we calculate the correlation coefficient. 31143 There is a difference of correlation coefficient between two adjacent pixels diagonally using our method is 0.97199 (plainimage) and 0.31143 (encrypt image). Similar results also occur in adjacent vertical and horizontal pixels, as shown in Table 3. It is apparent in Table 3. that the difference in coefficient of correlation between two diagonally adjacent pixels is significant enough to cause the two images to differ significant visually.

Conclusion
The proposed method produces significant grayscale histogram differences between the original image and the image after encoding so it can correct the weakness of some existing methods before. This method has been tested on many images and the result is very satisfactory because it has a high level of security and quite worthy of being called a good security system. This is demonstrated by the significant differences between plain images and both visual and histogram encoding images, in addition there are also differences in correlation coefficients between two adjacent pixels either vertically, horizontally or diagonally. We hope the next research not only analyze the histogram but also the MSE and PSNR so that the level of security to be better