Enhancing Image Security during Transmission using Residue Number System and k-shuffle

This paper proposes an algorithm that enhances the speed of transmission and secure images that are transmitted over internet or a network. The proposed cryptosystem uses a modified k-shuffling technique to scramble pixels of images and further decomposes them using Residue Number System. Simulations are done using two moduli sets with the modified k-shuffle technique. Analyses of results showed that both simulations could secure images without any loss of information and also the time taken for a complete encryption/decryption process is dependent on the moduli set. Among the chosen moduli sets, the even moduli set optimizes and completes execution using less time as compared to the traditional moduli set. The proposed scheme also showed resistance to statistical attacks (histogram, ciphertext, correlation attacks) and a significant reduction in the size of cipher images which enhances the speed of transmission over network.


I. Introduction
In the field of data communication, security and privacy remains the utmost concern over the years. The significant progress in computer and internet technologies have contributed to the survival of data communication but the internet has also made it possible to corrupt data easily during transmission since its possible for an adversary to manipulate his/her way to unauthorized information [1]. Digital images are widely used to communicate in different areas such as health, law enforcement, education, advertisement, entertainment and art [2]. They are used to carry several confidential information contents over public network which is not secure and hence the need to be 400 able to send them incognito. Steganography, cryptography and watermarking are options for securing images sent over computer networks. Several encryption algorithms have been proposed by researchers to help secure images during transmission but according to Kumari et al. [3], chaotic encryption algorithms are more secured than other schemes and are resistant to various statistical attacks; this means they are able to provide the security and privacy required during communication. Others such as Advanced Encryption Standard (AES) and Data Encryption Standard (DES) are not suitable for image encryption because of their file size, spatial redundancy etc. [4]. A good chaotic encryption algorithm should have a high-level confusion and diffusion; diffusion to reduce the correlation between pixel values and confusion to further change the pixel values [5]. Most of these algorithms are based on chaotic maps such as Arnold's transform, logistic maps, 2D cat map, tent map, baker map, standard map etc. However, these transforms have their own weaknesses ranging from inability to process rectangular images to small key space. Alhassan and Gbolagade [6] modified Arnold's transform to process images of all dimensions but increased the time taken to process rectangular images because the algorithm was modified to resize images. Noura et al. [7] stated clearly that 2D cat map only iterates once and has a small key space which cannot withstand a brute-force attack. Irrespective of weaknesses in some chaos algorithms, extensive research is still ongoing in this area of cryptography. Clearly, chaos encryption algorithms are better suited for the security and privacy of images.
Against these backdrops, the need to design an algorithm that can ensure the security and privacy of digital images cannot be overemphasized. Although there have been several researches on chaos image encryption algorithms, many are based on the traditional transforms mentioned earlier. This study is designed to use Residue Number System (RNS) and k-shuffle which is a card shuffling technique to formulate a new chaos image encryption algorithm.

A. Digital Images
Picture elements also known as pixels are the building blocks of digital images; they are the smallest basic unit of images. Each colour (or gray level for black and white images) is represented by a pixel at every single point in the image; this means that a pixel is a small dot of a colour [8] which can be thought of as a discrete sample value of continuous real image.

401
Consider a 512 × 512 image as shown in Figure 1. Let the image be the matrix X. Thus X consists of 512 rows of pixels and 512 columns of pixels, with a total of 262144 pixels. There are three main types of images, namely, binary images, black and white images and colour images. Binary images are made up two distinct colours; black and white. With this kind of image, a pixel is either white or black and no midway shades of gray. A single bit can be used to represent a pixel in binary images, either 1 or 0. Black and white image consists of pixels that range from black to white. These kinds of images display different shades of gray. A 256 gray level can have each pixel stored in a single byte (8 bits) memory. A colour image consists of pixels that hold three numbers that represents red, green and blue in a location. Red, green and blue (RGB) are the primary colours used in mixing light to generate any other colour provided the correct amount is mixed. A 256 level of each colour will require 8 bits for each colour which implies that, each colour pixel requires three bytes (24 bits) of memory to be stored [9]. Images carry much information and therefore need to be protected especially from unauthorized users. Sending images over internet makes it vulnerable and hence the need to encrypt before sending them across networks.

B. Cryptography
A field in computer science and mathematics that deals with the formulation of secured communication between two parties in the presence of a third party is cryptograph [10,11].
Data or information that can be understood at its original state without any special technique applied on it is called a plain-text (cipher-image). The method of disguising plain -text in a way its contents cannot be understood is encryption. When a plain-text is encrypted, the output is called cipher-text (cipher-image). Encryption is used to ensure 402 that, only the intended receiver of a message understands it. The method used in converting cipher-text back to plain-text is called decryption [12]. Figure 2 depicts the encryption and decryption process.

C. Image Cryptosystems based on Chaos
Image scrambling transforms are mainly used to generate a chaos image aimed at making it difficult for human vision/ computer vision systems to decipher the true meaning of original images and to make it possible to retrieve the original image from the scrambled image if the user understands the scrambling technique that was used [13].
Over the years, many image encryption schemes based on chaotic systems have been proposed by researchers. The first of this kind was proposed in 1960 by a Russian mathematician Vladimir I. Arnold known as Arnold's cat map [14].
Arnold's cat map is defined as the mapping [15]; where x, y are vector values of X and Γ is Arnold's cat map operation.
Arnold's encryption scheme is robust but periodic and cannot be used on rectangular images except square images. The periodicity in it was its greatest vulnerability since a cryptanalyst can easily study the number of times an image needs to be shuffled before the original image is retrieves from the encrypted one.
Chung and Chang [16] presented a novel method for binary image encryption. In their approach, dissimilar scan patterns are put at similar level in the structure of the scan tree and a run-encoding technique that is two-dimensional is employed. The encryption scheme can encrypt images well, giving higher security and a good compression ratio when compared to the earlier results. However, this new approach requires high processor power to be able to encrypt and compress an image in time before transmission because of the several scan patterns that is being used and can be used on binary images only.
Enhancing Image Security during Transmission using Residue Number System … Salleh et al. [17] have proposed an alternative symmetric-key encryption approach for securing images. This encryption scheme comprises of three main functions. . The second is the nonlinear feedback substitution which changes gray scale level of pixels by performing a bitwise non-linear feedback operation. The last which is the third function is used to further randomize the position of pixels by rotating each pixel to the left with 0, 1, 2, 3 or 5 shifts depending of the modulus of the value of the row number in which the pixel is located. But the gray level of encrypted images changes due to permutation and substitution operation on the bits in the algorithm. This algorithm proved robust but could not encrypt colour images.
Zhang et al. [18] improved the features of confusion and diffusion with regards to discrete exponential chaotic maps. A key scheme was designed for the resistance to differential attack, grey code attack, and statistic attack. Results analysis indicate that the scheme is efficient and very secure. The only flaw in this algorithm is that, it was designed with the assumption that all images to be encrypted are square images and will not encrypt rectangular images efficiently.
Mitra et al. [19] proposed a new approach for image encryption using a blend of different permutation techniques of bits, pixels and blocks aimed at reducing the correlation among neighboring pixels. The application of different permutation techniques is random and does not follow a prescribed order. This approach to encryption proved effective and easy to implement. Implementation of this algorithm during transmission over a network will require more time or higher resource since the sequence of the permutation process must be the precise reverse of the order used at the transmission end. So, the random combination seed generated at transmission must also be sent to the destination of the encrypted image through a secure communication/ transmission channel else the output will produce no visible information.
Shao et al. [13] proposed two kinds of two-dimensional matrix transforms called 2D triangular mappings meant to overcome the short comings of the 2D Arnold transform and 2D Fibonacci-Q. These transforms can encrypt and decrypt rectangular images without resizing them at a low computational cost. However, it could not encrypt 3D images.
Younes and Jantan [20] made known a block-based transformation process that is 404 based on the combined knowledge of image transformation and Blowfish encryption algorithm. Results after simulation showed that the correlation between values of pixels was decreased significantly but required high computer resources to complete encryption and decryption process.
Struss [21] used both the Arnold's cat map and Chen's chaotic map for an image encryption algorithm. The first transform is used to shuffle the pixel values of images whiles the second is used to change the grayscale values of pixels. This blend of the two transforms approach changes the gray values and mixes up the location of pixels. This make it more secure than using a single approach. However, this encryption scheme works on grayscale images and affects the original appearance of the image.
Ahmad and Alam [22] proposed a novel image cryptosystem based on three chaotic maps. In the proposed algorithm, the original image is disintegrated into blocks of dimensions 8 × 8. Thus, image random playback is performed using the 2D cat map in blocks. Random order parameters are randomly generated using a coupled 2D logistics map. Subsequently, the mixed image is further encrypted using a one-dimensional generated logistic sequence of maps. This scheme was safe but works only in 2D square images.
A novel algorithm proposed by Chattopadhyay et al. [23] for encoding digital images uses a circle map with three parameters. Their algorithm showed an increase in security of encrypted image against chosen-plaintext, cipher-text-only and chosen-cipher-text attacks. But had a relatively small key space that may not stand a brute-force attack.
Mishra et al. [14] introduce a novel spatial domain image scrambling map formed on Fibonacci and Lucas series that is capable of being used in several spatial domain image processing approaches of disguising data and secret communications such as Steganography and watermarking. Though it was a good system, it was periodic and could only encrypt grey scale images.
Alhassan and Gbolagade [6] used a modified Arnold transform algorithm and the to propose an image encryption scheme. Their encryption scheme uses RNS to Decimal encoder to decompose an image into three residues. These residues are then merged together and then encrypted using the modified Arnold transform. Their approach proved robust against several attacks. However, their proposed scheme resizes the original image into a perfect square before processing which increases the processing time.

Enhancing Image Security during Transmission using Residue Number System …
An encryption scheme founded on the moduli set { } was proposed by Reddy and Karumuri [24]. Their approach was to reduce the pixel values to their residues and combine them to form continuous words that could be further encrypted using advance encryption standard. However, advanced encryption standard is likely to increase the file sized because of the redundancy in image data. Also, AES comes with padding which also increases data size slightly.
Amalarethinam and Geetha [25] proposed an encryption and decryption in public key cryptography based on magic rectangle. In their approach, the images to be encrypted will have their byte values extracted and transposed as magic rectangle values. These magic rectangle values are further encrypted to produce a cipher text. Numerical values of the magic rectangle are displaced from their original positions and encrypted to produce the cipher text. Therefore, images that are encrypted using this approach are stored as text and converted back to images after transmission by reading the text, decrypting it and rearranging the values in the magic rectangle and transforming it into an image. This increases the average time taken to decrypt an image.
Chakraborty et al. [26] proposed an encryption scheme using DNA substitution and chaotic maps. This method selects an image pixel, converts it into 8 bits binary format and now reverses it. The reversed bits are then divided into four pairs and four new parameters are chosen for the logistic map as key. For every pair, a 12 bits sequence is generated using chaotic logistic map. And the 12-bit sequence is divided into 3 groups of length 4. Then a binary sequence of length 4 is generated by performing an XOR operation on the three groups key sequence. The 4-bit sequence is reversed, decimal value found, and the mod 6 value is calculated to select the transformation sequence. Now, the key is divided into 6 groups of length 2 by performing an XOR operation on the 6 groups key sequence, and the 2 bits are reversed. The decimal value of the reversed two bits is then found and converted to mod 3 as the iteration number. A complementary value is chosen from the sequence and used to find the encoding value in decimal. After all these operations produces four values which is converted to binary and all pairs are reversed. The pairs are then combined to get an 8-bit binary sequence and for the 4 pairs, a 48 bits key sequence of which we divide into 6 groups of length 8. A binary sequence of length 8 is generated by performing XOR operation on the 6 group key sequence which is reversed, and the decimal value is then calculated. The calculated value is then assigned as the encoded image pixel. This approach for securing images proved robust but uses more time to complete an encryption process.

406
An image encryption technique proposed by Ferdush et al. [27] combines the idea of one time pad with RGB value. Their scheme performs a bitwise XOR operation between RGB and a false image which is generated by the key generator. The bitwise operation is what is referred to as one -time pad. The R, G and B value of the resultant image are swapped in the follow order; • Green image = Blue image After the above operation, every pixel value of the red images is randomized using a formula and mod 255 of each pixel is calculated. The final red green and blue image is the cipher image.
Deshmukh [28] proposed image encryption and decryption using Advanced Encryption Standard (AES) algorithm. This encryption scheme encrypts by substituting the bytes, shifting rows, mixing columns and adding a round key. These four transformations mentioned are applied on an image respectively to encrypt it. This algorithm proved secured because it has large key space and resistant to attacks such as plaintext attack, cipher attacks and brute force attack. Apply four transforms will require high computer resources making this encryption scheme quite expensive in terms of computer resources and AES will increase the size of image after encryption.
Kalubandi et al. [29] proposed an encryption algorithm using AES and visual cryptography. There are two inputs in this approach; the image to be encrypted and the key which is a string. The key is then converted to hashes using SHA 256 hashing algorithm. The image is then encoded into Base64 string. The encoded image and the hashed key are then used to produce a cipher text by passing them through AES 256 encryption algorithm. The original key is then transformed into an image using ASCII encoding and then splitting the produced image into shares. This was simulated using python. After the cryptanalysis on this encryption scheme, the system proved robust against all known attacks. However, it involves several time-consuming processes which slow down the entire encryption and decryption system.
Fu et al. [4] suggested a new image security algorithm for colour images. This algorithm employs the hyperchaotic Lu system and logistic map. The hyperchaotic Lu system generates the keystream sequence for encoding pixel values whiles the logistic Enhancing Image Security during Transmission using Residue Number System … map generates the keystream sequence for mixing up the pixels. A disturbance is also introduced during the iteration period to increase entropy of pixel values. Results from the analysis of this encryption scheme proved some higher security against various statistical attacks but take a longer time to process given limited computer resources.
Ye et al. [30] introduced an encryption algorithm that contains modulation, permutation and diffusion in processes in it. Entropy of image information is involved in the generation of keystream. Keys used in the permutation and diffusion processes interact with each other so that the algorithm can act as one entity to enhance security.
Yu et al. [31] proposed a new cryptographic scheme for four images based on Fresnel transformations (QFST) quaternion, computer hologram and the twodimensional map regulated sinusoidal logistics (LASM) (2D) generated is presented. To treat the four images holistically, two types of Fresnel transform (QFST) were used to defined quaternions and the corresponding calculation method for a derived matrix quaternion. In the proposed method, the four original images, which are represented by the quaternion algebra are processed in a holistic vector mode using QFST first. Therefore, the input of complex amplitude, is constructed with components of the clear images transformed with QFST, codified by the Fresnel transforming two virtual independent random phase masks (RPM). To avoid sending RPMs complete the receiver for decryption, the RPMs are generated using 2D-LASM, which makes the amount of key data drastically reduced. Subsequently, using the Burch method and the displacement interferometry, the hologram generated by the computer is produced. To improve security and weaken correlation, the encrypted hologram is encoded in 2D-LASM. The experiments demonstrate the validity of the cryptographic technique of the proposed image. But there is a significant increase in the size of cipher images produces from this method.
Liu et al. [32] experimentally implemented a color image cryptography system based on optical chaos with embedded ARM hardware. The experiment uses a vertical cavity surface emission laser (VCSEL) subject to positive optoelectronic feedback and the chaotic signal is obtained with the appropriate parameters. The chaotic optical signal is transformed into chaotic optical data via an analog-to-digital converter. In the experiment, chaotic optical data dominates the cryptographic process of the image in which the advanced gravitational model and the double-breast map serve to encrypt the color image. The encrypted image can be transmitted securely through cloud services and therefore the hardware card can decode the encrypted image in an incomprehensible 408 way. The experimental results clearly show that cryptography of color images was successfully performed.

A. Residue Number System
The study of Residue Number System (RNS) started in the third century by Sun Tsu who presented an approach to using the remainders of an integer after dividing it by 3, 5 and 7. Congruence relation is the bases for RNS, which is defined as follows.
Two whole numbers a and b are considered congruent modulo m if the difference of a and b can be divided by m without a remainder: mathematically, it is common to write a ≡ b (mod m) to represent this. In this way, for example, 11 ≡ 8 (mod 3), 11 ≡ 5 (mod 3), 10 ≡ 1 (mod 3), and 10 ≡ -2 (mod 3). The whole number m is a modulus or base, and the assumption is that, its values exclude unity, which produces only trivial congruencies [33].
If r and q represent remainder and quotient, respectively, of the integer a when divided by m, that is, r m q a + ⋅ = then, by definition, a ≡ r (mod m). The number r is referred to as the residue of a with respect to m, and usually denoted by .   These two piles can further be re-arranged via 8 different iterations to obtain the original arrangement back. This is referred to as the perfect-2-shuffle or faro shuffle. There exist two instances of perfect-2-shuffle or faro shuffle; an out shuffle which leaves the top card at its original position and the second shuffle which makes the top card the second [35,36], Ramnath and Scully [37], [38].  [36], a perfect k-shuffle rearrange the cards in the following way; draw all first cards from each pile, followed by the second, third, fourth, right up to the last card in each pile. The first and the last card remain at their respective positions after the re-arrangement. The order of a perfect k-shuffle as described [36]; is the minimum number of times the k-shuffle need to be iterated to return cards to their original arrangement. (

1) Modified k-shuffle Algorithm for Images Encryption
The traditional k-shuffle is a technique for shuffling cards and will not be better suited for shuffling images. Therefore, it has been modified in the algorithm below for images; Let P be the image, s be the number of rows or pixel values in P, k be the number of columns of pixels in P and I be the number of iterations.
• Read P • Put the rows (s) of P into one column (dp) • For each item in column dp o Pick the next s-value and stack into the ith column of P • Present the scrambles image as y.

(2) Reverse for Modified k-shuffle Algorithm for Images
This shuffling technique is top to down shuffling and non-reversible [39], but a 410 reverse algorithm has been formulated to be used in the decryption process of the proposed cryptosystem. The algorithm is as follows: Let y be the cipher image, k be the number of columns in y, n be the first item in column dp, i be the position which item is to be found and l the position of the last item in column dp • Read cipher image y • Put the rows (s) of y into one column (dp) • The first (1st) and last (l) items in column dp remain in the original position in y • For the rest of each item in column dp (2nd through to l-1) calculate the position o position = ((k*(i-1) + 1) mod(l-1)) o Go to the position and pick the item to the next position in y • Present the final arrangement as p.

C. Proposed Image Encryption Algorithm via k-shuffle and RNS
The encryption algorithm takes as input the original image (P), number of iterations for the k-shuffle (i) and number of bits (n) for the moduli set adopted. The output will be the cipher images x 1 , x 2 and x 3 that will be transmitted over network. The proposed encryption algorithm is stated as follows: • Input P, i and n • For each i o Scramble P using k-shuffle technique into the disguised form y • Find the residual cipher images x 1 , x 2 and x 3 using the RNS encoder • Transmit x 1 , x 2 and x 3 .

D. Proposed Image Decryption Algorithm
The decryption algorithm is the reverse of the encryption algorithm where the receiver receives the residual cipher images x 1 , x 2 and x 3 together with i and n, and decrypt them to the plain image P. The decryption algorithm is thus stated as follows; • receive x 1 , x 2 , x 3 , i, n The block diagram of the proposed cryptosystem is shown in Figure 3.

IV. Results Analysis and Interpretation
Results and interpretation of the proposed cryptosystem are presented here. All simulations and interpretations of results obtained are done using MATLAB Simulink simulation tool. The simulations were done using the moduli sets }  Figure 4. The encryption process consists of 'kshuffle_Encoder' and 'RNS_Encoder_CRT' subblocks. 'kshuffle_Encoder' receives the original image (P) together with the number of 412 reshuffles (iter) and number of bits (n) and encrypts P into the cipher image (y). y is fed into 'RNS_Encoder_CRT' as X along with n to be encoded into the residual images x 1 , x 2 and x 3 for transmission. At the receiver's side, the residual cipher images (i.e. x 1 , x 2 , and x 3 ) are decoded back into the cipher image X using the 'RNS_Decoder_CRT'. X is subsequently de-shuffled into the original image P using the 'kshuffle_Dencoder'. The subblock 'Video ViewerCRT' receives y as image and displays it.  The MATLAB Simulink system for simulating the proposed image encryption and  decryption algorithms using the moduli set  }  2  ,  1  2  ,  2  2  {  n  n  n  +  + is shown in Figure 6.
The encryption process consists of 'kshuffle_Encoder' and 'RNS_Encoder_LCM' subblocks. 'kshuffle_Encoder' receives the original image (P) together with the number of reshuffles (iter) and number of bits (n) and encrypts P into the cipher image (y). y is fed into 'RNS_Encoder_CRT' as X along with n to be encoded into the residual images  (2) Key space analysis: For any cryptosystem to resist Bruce-force attack, its key space should be reasonably high since this form of attack depends exhaustively on the search of the key space. The proposed scheme has two key parameters (number of reshuffles(i) and number of bits for encoding(n)). The length of i depends on the dimension of the given image while n does not exceed 2 8 . Thus, for a 256×256 image, i = 2 16 and n = 2 8 . Any adversary using Bruce-force attack needs approximately 2 16 × 2 8 = 2 24 ≈ 16,777,217 key combinations to exhaustively search the entire key space in order to recover the original image. Also, cipher images can be transmitted in 3! different ways which adds extra security to transmitted cipher images. The adversary needs the correct association of moduli set to residue images. Hence, given limited computing resources the proposed scheme offers some level of resistance to Bruce-force (3) Key sensitivity analysis: Every good cryptosystem should be highly sensitive to slight changes to the key parameters used for both encryption and decryption process.
Each key parameter set should produce different cipher/recovered image when used. To test the effectiveness of the proposed scheme, one set of key parameters are used for encryption and different sets of key parameters are used for decryption of the cipher images obtained. The difference here are the change in only one of the key parameters (an increment of 1 was used in this case for i) used for encryption and the other maintained. Figure 10 shows failed recovered images when the cipher key parameters are (4) Procession time: In order to measure the speed of the proposed schemes the processing time used by MATLAB to encrypt/decrypt given images were measured using a system with 1.6GHz (2 CPUs) processor and 4GB memory. Table 1  Thus, in terms of processing speed the former is better than the later. This is because the reverse conversion of the earlier is optimized as compared to the later. The processing times of each of the sub-blocks in proposed schemes are summarized in Table 2. In comparison, 94% of the encryption processing time is attributed to the k-shuffle process while the RNS process only takes approximately 6%. On the other hand, approximately 15% of the decryption time is attributed to the RNS decoding process while k-shuffle decoding process takes 85%.
Enhancing Image Security during Transmission using Residue Number System … (5) Encoding analysis: The weight of a pixel in an image with 8 bits-per-pixel (8 bpp) spans 0 to 255. Thus, 8 bits are required to encode every pixel in such an image. The introduction of RNS reduces this bit requirement to a significant level. For instance, at best performance, the chosen moduli sets encode a 255 pixel to a 3 bpp value. This is less than half the original bits required to encode and transmit a 255 pixel. Thus, transmission speed is enhanced since smaller values are used. Table 3 shows a summary of original size and size of cipher during transmission. It is therefore clear that the proposed schemes reduce the size of cipher images significantly. Hence improving the speed of transmission. x x x + + Enhancing Image Security during Transmission using Residue Number System … (6) Chosen /known plaintext attacks: Figure 11 shows the histogram analysis of chosen/known plain text attacks. Part (c) is the histogram of XOR-ing the plain image (a) and its corresponding cipher image (b). Part (e) is obtained by XOR-ing part (c) and an unknown cipher image (d). Since the histogram of (a) and (e) are completely different the proposed techniques are resistant to chosen/known plaintext attacks. Figure 11. Histogram analysis of chosen/known plain text attacks.
(7) PSNR and MSE for the encryption schemes: The peak signal-to-noise ratio (PSNR) and the Mean Square Error (MSE) are error metrics that are used to ascertain the quality of a compressed image compared to the original. PSNR is used to determine the quality of the compressed image whiles the MSE is the cumulative square error between original and compressed image. A high PSNR indicates a quality image whiles a high MSE indicates a high error margin between original and compressed image. Therefore, a low PSNR and a high MSE between an original and cipher image shows the vast difference between original and cipher images. In this analysis, the MSE and PSNR of images and their respective ciphers will be calculated and interpreted.
(8) Entropy analysis: The statistical measure of the randomness that characterizes image texture is known as entropy. The entropy (H) of a source (S) can be calculated using the following (Ahmad and Alam [22]); • Is independent of periodicity in its decryption process. Thus, the number of iterations to conduct is at the discretion of the user; • Is also highly sensitive to a small change in any of the cipher keys; • Recovers plain-image with minimal or no loss of any inherent feature.