Performance analysis of gray code number system in image security

resistance to statistical attacks.


I. INTRODUCTION
A digital image can be defined as an m by n rectangular array of dots, where m is the number of rows, and n is the number of columns. In technical terms, a digital image P is a rectangular array of intensity values { p i, j } i, j=1 m , n . For gray-level images, the value Pi, j is a single number, while for color images Pi, j is a vector of three or more values. If the image is recorded in the RGB-model, each Pi,j is a vector of three values, p i , j = ( r i , j , g i, j ,b i , j ) . This denotes the amount of red, green and blue value at the point (i, j). The value Pi,j gives the color information at the point (i, j). There are many formats for this. A digital image is made up of a raster of picture elements called pixels (Bitmaps). Each pixel is a very tiny square that is assigned a color and then arranged in a pattern to form the image. It has two properties, namely pixel location, and color. The resolution (finesess) of an image is the number of available pixels per unit area in the digital image [1], [2].
Recently, images have found widespread usage in many applications and fields, such as in the area of medicine, military, entertainment, art, education, and advertising due to its high information representation ability. Aside from the fact that images require the less cognitive load to understand, a digital image can produce at a glance information that can be spread across about ten pages in a book [3]. However, owing to the rapid developments in the efficient internet technologies and compression techniques the need for securing digital images during transmission and storage cannot be overemphasized [1], [4]- [7]. The main idea behind image security includes confidentiality, authentication, conditional access, integrity, content tracking, and copy control [7]- [9].
All digital system configurations depend so much on number systems [1], [10], [11]. There are majorly two number systems in the literature; the conventional or positional (Weighted Number System) and the unconventional or the non-positional (Unweighted Number System) number systems. Digital devices are mostly built around the weighted number systems (WNS) [1], [11]. The major problem with the WNS is in the carrying propagation chains in its operations, and to improve the performance of processors built around WNS in terms of speed and area cost. Hence, there is a need to eliminate the associated inherent carry propagation. Most unconventional number systems, such as residue number system, and gray code number systems, provide solutions to these problems. Gray code number system is an encoding of number in which adjacent numbers have a single-digit differing by 1 [3]. The number system has the property that there is only one bit change between any two consecutive numbers. The numbers are arranged so that every transition from one value to the next value involves only one bit change. It is referred to as a mirrored binary number system because the first eight values can be compared with those of the last eight values but in reverse order. There are many types of Gray Code arithmetic; n-ary, balanced, monotonic, Beckett, and single-track Gray code number systems have been reported in the literature.
The n-ary Gray code number systems use non-Boolean arithmetic in its encodings. A special kind of nary gray code called the (n, k, p) gray code was proposed in [12]. This n-ary Gray code presents a new distant parameter p with the idea of the (n, k) Gray code. The new (n, k, p) Gray code changes as the estimations of the base n and the distant parameter p differ.
Gray code arithmetic has been reported to be efficient in its application in the area following areas in the literature; straight and rotational shaft position encoding systems, puzzle challenges solver, error corrections, genetic algorithms, protection of digital circuit designs, image processing, image stabilization, video processing, and scrambling [1], [3], [13]- [20]. Although the use of the Gray code number system can be applied in so many areas, its unweighted nature has made it is so unsuitable for arithmetic operations [21]- [23]. Various image encryption techniques have been reported in the literature.
Three types of encryption techniques exist; position permutation-based algorithm, value transformationbased algorithm, and hybrid substitution-based algorithm.Permutation-based algorithms rearrange image pixels using bits, pixels, or blockwise means, and transformation algorithms transform each pixel value with a new value. The hybrid substitution-based algorithm uses both permutation and transformation by combining them [1]. In [21]- [27] were reported for the position permutation-based algorithms, [28]- [30] have been reported for value transformation based algorithms while [12], [27]- [40] reported for hybrid substitutionbased algorithm.
Researchers over the years have proposed various security measures, such as digital watermarking, encryption, compression, and steganography, to tackle this problem of insecurity image transmission and storage [5], [6], [8], [41]- [53]. All these methods are not efficient owing to their inability to encrypt images of m by n size [5], [6], and attain high degree encryption without pixel location permutation or scrambling [3].
This paper presents a scheme that encrypts and decrypts digital images of all sizes without positional scrambling. This proposed encoding methodology is designed to be able to transform the pixel values of an image without having to alter the pixel position (without scrambling). The proposed scheme, which utilizes the Gray code number system, will be demonstrated to efficiently secure digital images from unauthorized access during transmission and also retrieve the plain image without loss of any inherent information.

II. RESEARCH METHODS
The primary aim of this paper is to analyze the performance of gray code arithmetic in image security.
The work presents the implementation and security analysis of the algorithms presented in [1].
The algorithm was carried out in two phases. The first phase was designed to encode the binary representation of images to gray code values. G is the (n, k, p) gray code of k bits base-n nonnegative image X if the sequences are satisfied with G= ( C p * X ) mod n . C p is a constant for converting binary to gray-code. and n is the base. If C p =M p , then G will be (n, k) gray code. If C p =O p , then G will be (n, k, p) Gray code with distant parameter (p) of 2.  x 6 x 5 x 4 x 3 x 2 x 1 x 0 ] ) mod n If p = 2, k = 8 and n = 2, then the matrix can be shown as: x 6 x 5 The second phase was used to encrypt the pixel values of m by n images such that two neighboring pixel values with the same RGB information will not have the same cipher information. For this, each pixel location is scanned. Based on the scan result, an algorithm is selected to encrypt the pixel location. There are four possible algorithms to be selected from using Eq. 1. If the result is 0, then an algorithm style is selected, but if it is 1, 2, or 3, then different unique algorithms are picked.

III. RESULTS AND DISCUSSION
The proposed scheme was analyzed using visual test, encoding and security analysis.

A. Visual Test
In all, three images of different sizes in colored format were used to test the developed system. Figure 1 shows the test results for the images; Baboon (512*512) in png format, Lena (512*512) in png format, and eggs (300*250) in jpg format. The visual test shows an absolute absence of resemblance among the pairs of images.
In a bid to prove that the decrypted image fully recovered the original image without any inherent loss, the histograms of both original and decrypted images were compared and shown in Figure 2 (Baboon), Figure  3 (Lena), and Figure 4 (Eggs). The pixel histogram test revealed that the distribution of the plain images and their decrypted image counterparts have the same pixel histogram distributions, which means that there is a high correlation between the original images and decrypted images. Hence, the proposed scheme can fully recover the original image without any noticeable loss of features.

B. Encoding Analysis
The encoding analysis generated some results, as presented in Tables 1 and 2. Table 1 shows that the size of the images reduced meaningfully. This pronounced reduction in size means that there will be a very fast transmission rate of the encrypted images during transmission since very few bits will now be used to represent the encrypted images while being transmitted. Also, since the size has reduced, it means the memory requirement for storing the encrypted images is also reduced and has been presented in Table 2. Also, from the results presented in Table 2, the developed system achieved in terms of encryption and decryption time when compared with the results presented by [4]- [6].

C. Security Analysis
The security and strength of the encryption system are analyzed by subjecting outputs from the system to histogram analysis. Encrypted images are always well secured against statistical attack when its histogram   proposed scheme is resistant to statistical attacks, which makes it highly secured. The scheme outperforms the schemes in [4]- [6], [38] in terms of computational time, and its ability to secure non-square images. The developed scheme could be used for protecting privacy in biometrics, medical imaging systems, and video surveillance systems. In the challenges for the future, the researcher intends to perform other listed statistical analyses and also extend the scheme to test its applicability in securing continuous images (video).

IV. CONCLUSION
This scheme presented an image cryptosystem that encrypted various digital image types and sizes, reduction in computational complexity in encryption and decryption processes of digital images and an improved efficiency in terms of the processes involved in securing a digital image by developing a positionbased pixel value transformation algorithm. This research work has introduced a value transformationbased cryptosystem that selects algorithm for pixel transformation based on its position and offers better encryption without the need for pixel scrambling.