Printer Friendly

An Improved Image Scrambling Algorithm Using {[2.sup.n] -1, [2.sup.n], [2.sup.n] +1}.

1 Introduction

The security of information is a major concern in every facet of life. The increasing usage of internet and networking technologies has greatly increased the threat to both information and data. Images have found usage in diverse areas such as in medicine, military, science, engineering, art, entertainment, advertising, and education. With the high usage of digital and sophisticated methods for and storing and transfer of images, the issue of protecting the authenticity, integrity and confidentiality of images has become a great concern. Encryption of images is simply coding or protecting the intelligible element of an image which automatically turns the image to something that cannot be easily recognized or decoded by anyone except the recipient of such images. Several image encryption and scrambling methods have been explored to improve the security hidden and encrypted data (Wang, Chang, Liu, Song, and Liu (2015). Image scrambling methods usually scramble the pixel location of digital images in such a way that they become unrecognizable and indistinguishable. (Radu, Cristina, Iustin and Cristina, 2014).

Furthermore, image encryption uses two basic methods: the replacement and scrambling method. The replacement method is changing the value of the pixel in the image while the scrambling method is changing the position of the pixel in image that makes the image chaotic for an intruder. The user who has the key is the only one who can access the content of the original image and can reconstruct the original image from the scrambled or decrypted entity. Scrambling techniques are solely based on permuting coordinates of pixels.

This technique uses the steps below to implement scrambling of an image:

a) build a matrix with the same size of the image to be scrambled (let size of the matrix be s) and every element in it is assigned different natural numbers taking values from 0 to s-1;

b) map the generated matrix to the image matrix each row and column at a time, every element's value in the newly generated matrix is as the coordinate of the corresponding pixel in image matrix;

c) move every pixel to the next position to them; if the mapped pixel coordinate is designated as x, move the pixel into the position with the mapped coordinate (x+1) mod s.

From the methods above, the most important step is to generate a matrix as coordinates shifting path (Rhine and Bhuvan (2015). Rhine and Bhuvan (2015), established that the scrambling method can withstand tougher third party intrusions compared to the replacement method, hence our choice. There are two (2) types of scrambling methods, the one that is based on a 2D matrix transformation and the other based on 2D Arnold transformation (Alhassan and Gbolagade, 2013). Encryption based on 2D Arnold transformation is not suitable for images with different numbers of rows and columns; it increases the data redundancies which automatically increases the disk size of such images and reduces the quality (Alhassan and Gbolagade, 2013).

This scheme will implement a pixel scrambling algorithm) with moduli sets {[2.sup.n]-1, [2.sup.n], [2.sup.n] +1} using both forward and reverse conversions) to achieve an enhanced image encryption process and a more efficient decryption process without lost of any inherent information of the recovered plain image.

2 Literature Review

2.1 Residue Number System (RNS)

Residue Number System comprises of a set of moduli that are independent of each other. An integer is represented by the residue of each of the moduli and arithmetic operations are based on residues individually. The advantages of using the RNS over the conversional system include parallelism, modularity, "a carry-free" operation and fault tolerance (Gbolagade and Cotofana, 2008). These features make RNS to be widely acceptable and used in Digital Signal Processing (DSP) applications such as image processing, convolution, digital filtering and fast Fourier transform (Alhassan and Gbolagade, 2013).

Let {[m.sub.1], [m.sub.2], [m.sub.3],...,[m.sub.n]} be a set of positive integers all greater than 1. mi is called a modulus, and then n-tuple set {[m.sub.1],[m.sub.2], [m.sub.3],...,[m.sub.n]} is called a moduli set. Consider an integer number Y. For each of the modulus in { [m.sub.1],[m.sub.2], [m.sub.3],...,[m.sub.n] }, we have [y.sub.i] = Y mod [m.sub.i], (denoted as |Y|[m.sub.i]). Thus the number Y in this system is represented as Y = ([y.sub.1], [y.sub.2], [y.sub.3],...,[y.sub.n]), 0[less than or equal to][y.sub.i] < [m.sub.i]. Siewobr, Gbolagade and Cotofana (2014).

For example, take the moduli set {7,8,9}, the number 150 can is depicted in RNS as:

[y.sub.1] = |Y|[m.sub.1] = [|150|.sub.7]=3 [y.sub.2] = |Y|[m.sub.2] = [|150|.sub.8]= 6 [y.sub.3] = |Y|[m.sub.3] = [|150|.sub.9] = 6

Thus, the RNS representation of 150 is [(3,6,6).sub.RHS(7,8,9)].

In order to avoid redundancy, moduli set must be pair wise relatively prime. Thus gcd ([m.sub.1], [m.sub.j]) = 1 for i[not equal to]j, where gcd is the greatest common divisor of [m.sub.i] ,[m.sub.j].

Let [mathematical expression not reproducible], then the RNS representation is unique for any integer Y [member of] [0,M - 1] M is called the dynamic range. Siewobr and Gbolagade (2012).

2.2 Forward Conversion

Forward conversion is done by a forward converter which decomposes a weighted binary number into a residue represented number with regards to a moduli set. It is the conversion from a conventional representation to a residue representation by dividing the number X by each of the given moduli and then collecting their remainder (Gbolagade and Cotofana, 2008).

For example, given moduli set {3, 4, 5}, 4 is depicted in RNS as:

[x.sub.i] = |X|[m.sub.i]... .... (2-1) [x.sub.i] = |X|[m.sub.1] = [|4|.sub.3], = 1; [x.sub.2] = |X|[m.sub.2] = [|4|.sub.4] = 0; [x.sub.3] = |X|[m.sub.3] = |4|.sub.5] = 4

Therefore, the depiction of 4 in RNS is [(1, 0, 4).sub.RNS (3,4,5;)]. (Baagyere, Boateng and Gbolagade, 2011).

2.3 Reverse Conversion

The conversion from residue to a conventional representation (either binary or decimal representation) is known as reverse conversion. The two most widely used techniques of reverse conversion are the Mixed Radix Conversion (MRC) and Chinese Remainder Theorem (CRT) and Gbolagade, 2009; Gbolagade 2009).

2.4 Chinese Remainder Theorem

For a moduli set {[m.sub.1],[m.sub.2],...,[m.sub.k]} with gcd([m.sub.1],[m.sub.j]) = 1 for i[not equal to]j and a dynamic range [mathematical expression not reproducible], the residue number ([x.sub.1],[x.sub.2],...,[x.sub.k]) can be converted into the decimal number X if the moduli set are co-prime (Salifu and Gbolagade, 2016; Gbolagade, 2009).

[mathematical expression not reproducible] (2.2)

[mathematical expression not reproducible] and [mathematical expression not reproducible] and [mathematical expression not reproducible] is the multiplicative inverse of [M.sub.i] with respect to [m.sub.i].

2.5 RNS to Weighted Conversion

A (R/D) Residue to Decimal converter (decoder) is required to convert from a RNS to decimal. The two methods used to convert RNS to weighted systems are the Mixed Radix Conversion (MRC) and the Chinese Remainder Theorem (CRT).

The CRT is employed in this research (Bankas and Gbolagade, 2014).

Given {[m.sub.1],[m.sub.2], [m.sub.3],...,[m.sub.n]} which gcd([m.sub.1],[m.sub.j])=1 for i[not equal to]j and dynamic range [mathematical expression not reproducible], by the CRT, an integer labeled Y whose depiction in RNS is ([y.sub.1], [y.sub.2], [y.sub.3]......... [y.sub.n]) can be converted from its residue as

[mathematical expression not reproducible] (2.3)

Where [M.sub.i] = M/[m.sub.i] and [mathematical expression not reproducible] is the multiplicative inverse of [M.sub.i] with respect to [m.sub.i].

Considering {7, 8, 9) as a moduli set,

10 = (3,2,1) M= 7x8x9 = 504 [M.sub.1]=504/7= 72, [M.sub.2] = 504/8 = 63, [M.sub.3] = 504/9 = 56 [mathematical expression not reproducible] [mathematical expression not reproducible]

Therefore, by the CRT

Y = |(72 x 5) + (72 x 6) + (56 x 5)|[.sub.504] Y = |360 + 378 + 230|[.sub.504] Y = |1018|[.sub.504] Y = 10


Y = |(72 x |4 x 3|[.sub.7]) + (72 x |7x 2|[.sub.3]) + (56 x I5 x 1|[.sub.9])|[.sub.504]

3 Methodology

The two main parts of the methodology are encryption algorithm and decryption algorithm as explained in the rest of this section.

3.1 Encryption Algorithm

(i) Pixel Scrambling (Scrambling Algorithm)

1. Original Image Input

2. Find number of rows and column (in total)

3. Point to the first pixel in the original image.

4. Let counter be 1.

5. Build new position of the current pixel in the cipher image by generating two random numbers (n1, n2) for row and column.

6. If the new position of cipher image as been generated before, then proceed to step 4, otherwise proceed to step 6.

7. Store n1 (value) in the array K1

8. Store n2 (value) in the array K2.

9. Current pixel of the original image will take the position (n1, n2) in the cipher image.

10. If all the pixels of the original image is exhausted, move to step 13 else proceed to step 10

11. Navigate to the next pixel on the original image.

12. Counter increased by 1

13. Proceed to 5

14. Terminate

(ii) Pixel Encoding (Forward Conversion)

Taking {9,8,7} as moduli set [2.sup.n]-1, [2.sup.n], [2.sup.n]+1 (n=3) [m.sub.1] = 9 [m.sub.2] = 8 [m.sub.3] = 7
Step 1: Generate Moduli images

128  108  66
151  113  179
139  120  132

Step 2: Send Moduli Images


2  0  3
7  5  8
5  0  4


0  4  2
7  1  3
3  0  4


2  3  3
4  1  4
6  1  6

3.2 Decryption Algorithm

(i) Pixel Decoding (Reverse Conversion)

[mathematical expression not reproducible] Equation 1

N=3 X= |[M.sub.1]|[M.sub.1]|[m.sub.l][x.sub.1] + [M.sub.2]|[M.sub.2]|[m.sub.2][x.sub.2] + [M.sub.3]|[M.sub.3]|[m.sub.3][x.sub.3]|M Equation 2

[M.sub.i] = M/[m.sub.i] Equation 3

[mathematical expression not reproducible]

(ii) Pixel Un-Scrambling (Unscrambling Algorithm)

1. Encrypted image input.

2. Keys K1 & K2 inputed.

3. Let counter be 1

4. Navigate to the first pixel of the cipher image.

5. n1=K1

6. n2=K2

7. Obtain (n1, n2 values) from the cipher image and let it inputted in the current position of deciphered image.

8. If the counter is not the last position of K1 and K2 proceed to 9 else move to 13

9. Increment counter by 1

10. Navigate to the next pixel of the cipher image

11. Proceed to step 5

12. Terminate

4 Result Discussion

4.1 Encryption Analysis

The encryption part of our scheme is based on two different algorithms, the scrambling algorithm and forward conversion (RNS). The scrambling stage has little effect on the size of the image or the pixel value of the images but rather it only changes the position of the pixels which enhances the security of the image.

4.2 Pixel Encoding Analysis

The pixel encoding brought out two distinct results. It drastically reduces the value of pixel and the size of the original image but keeps its coherent attributes. The drastic reduction in the value of pixel automatically speeds up time required for computation which is useful for other image processing processes.

Better put, the size reduction increases the speed of data during transmission over a network, since smaller bits are needed to stand in for the pixels and it also reduces the bandwidth required for transfer. Table 4.1 compares the size of the unencrypted and encrypted images when saved in a Joint Photographers Expert Group format. It is interpreted from the table below that the system obtains a reduction in size of up to 92%.

It is also efficient in memory allocation (Internal). It produces cipher images that is at least 2/3 the size of the original image. This saves a minimum 25% of internal memory allocation. Thus a 512 x512 plain image that requires about 262144 bytes of memory results in a 768 x 256 encrypted image requiring just 196608 bytes of memory and saving 65536 of internal memory that would have been allocated.

4.3 Time Complexity Analysis

We analyzed the time taken for our scheme to produce an output. The simulations were done a system with 1.86GHz processor and 1024 MB ram. The results obtained are shown in Table 4.2

4.4 Memory Requirement Analysis

The memory requirement for both the plain and cipher images are analyzed below. The size of an image before encryption is far higher on memory compared to the size of the cipher image i.e the encrypted image. It is the direct implication of the reduced pixel value implemented at the second encryption stage.

4.5 Security Analysis

We analyzed the security strength of the scheme as shown below, the two layer encryption this scheme implements (Random scrambling and Forward Conversion-Residue Number System) correctly repositioned the pixels of the image and while the forward conversion reduced the value of the pixels which makes it difficult to guess the original image from the encrypted and also makes the image smaller in terms of the size on memory.

Figure 4.1 (a) and (b) are the histograms of the plain image and the encrypted image. It is clear from the images above that you cannot guess or deduce Figure 4.1 (a) (Original image) from Figure 4.1 (b) (Histogram of encrypted image).

The two layer encryption this scheme implements (i.e Random scrambling and Forward Conversion-Residue Number System) has changed the position of the pixels and also the value of the pixels which makes it difficult to guess the original image from the encrypted.

5 Conclusion

This research proposed a simple scrambling algorithm to encrypt and decrypt the images based on random number generation and RNS (Forward and Reverse Conversion). The image is first encrypted by moving the position of each pixel in the image without having to change the pixel value of the image. The original image is read pixel by pixel, row by row and each pixel will assume a new position in the scrambled image. The new position is chosen using random number generation from the random number generator. The key will be generated as a matrix during the encryption process and also the key saves the position of each pixel in the encrypted/scrambled image. The encryption layer transforms the scrambled image to moduli images which automatically adds an extra security layer to our data (Image).


Alhassan, S, Gbolagade, K. A. (2013)" Enhancement of the Security of a Digital Image using the Moduli Set [2.sup.n]-1, [2.sup.n], [2.sup.n+1], International Journal of Advanced Research in Computer Engineering & Technology, 2(7): 2223-2229

Baagyere, E. Y., Boateng, K. O. and Gbolagade, K. A. (2011) Bioinformatics: An important Application Area of RNS, Journal of Engineering and Applied Sciences, 6(2): 174-179.

Bankas E. K. and Gbolagade, K. A. (2014) A New MRC Adder-based Reverse Converter for the Moduli Set {[2.sup.n], [2.sup.2n+1]-1, [2.sup.2n-2]-1}, The Computer Journal (Oxford), 12, 1-7.

Gbolagade, K. A. (2009) A Shorter Algorithm for Efficient Residue to Decimal Conversion, Advances in Computer Science and Engineering, 3(2), 147-156, ISSN 0973-6999.

Gbolagade, K. A., Cotofana, S. D. (2008) A Residue to Binary Converter for the {2n+2,2n+1,2n} Moduli Set, Asilomar Conference on Signals, Systems, and Computers, 1785-1789, California, USA.

Radu, B., Cristina D., Iustin, P. and Cristina, F. (2014) "A New Fast Chaos-Based Image Scrambling Algorithm" 10th international conference on Communication, 1-4.

Rhine, R., Bhuvan, N. (2015) Image Scrambling Methods for Image Hiding: A Survey, International Journal of Computer Science and Network Security, 15, 86-91.

Salifu, A. and Gbolagade, K. A. (2016) Mixed Radix Conversion based RSA Encryption System, International Journal of Computer Application (IJCA), 150, 43-47.

Siewobr H., Gbolagade, K. A., and Cotofana, S. D. (2014) An Efficient Residue-to-Binary Converter for the New Moduli Set {[2.sup.n/2][+ or -]1,[2.sup.2n+1],[2.sup.n]+1}. International Symposium on Integrated Circuits (ISIC 2014), (to appear), Singapore.

Siewobr H, Gbolagade, K. A. (2012) An Area Efficient RNS-to-Binary Converter for the Moduli Set {[2.sup.n],[2.sup.2n+1]-1,[2.sup.n]-1}, 4th IEEE International Conference on Adaptive Science and Technology, Kumasi, Ghana, 104-107.

Wang. D., Chang C., Liu Y., Song, G., and Liu, L. (2015) Digital Image Scrambling Algorithm Based on Chaotic Sequence and Decomposition and Recombination of Pixel Values, International Journal of Network Security, 17, 322-327.

Damilare Peter Oyinloye and Kazeem Alagbe Gbolagade

Department of Computer Science Kwara State University, Ilorin, Nigeria and
Table 4.1: sizes of unencrypted and encrypted images compared.

Image Type                                         Size(Size on Disk)
                              Unencrypted Image(kb)  Moduli Image (kb)

Love.jpg grayscale (512x512)  152                    20
Mountain.png (320x301)        163                     5
Easy.bmp (640 x 480)          301                    23

Image Type                           Size(Size on Disk)
                              Compression ratio (%)

Love.jpg grayscale (512x512)  86.84
Mountain.png (320x301)        96.93
Easy.bmp (640 x 480)          92.35

Table 4.2: Sizes of Original and encrypted images compared

                 Image details               Encryption algorithm
Image                   Number of elements   Scrambling  Encoding
                                             (seconds)   (seconds)

Lena(512 x512)          262,144              0.1100      7.5218
Checkerboard(256 x256)  196,608              0.2181      4.6122
Koala(448 x336)          45,184              0.1160      9.8514

Image details           Decryption algorithm
Image                   Decoding      Unscrambling
                        (seconds)     (seconds)

Lena(512 x512)           9.4065       0.1010
Checkerboard(256 x256)   4.8484       0.2050
Koala(448 x336)         11.4281       0.1847

Table 4.3: Memory requirement of plain and encrypted images compared.

Image      Size(disk space)                        Memory requirement
           Plain-image(kb)   Encrypted image (kb)  Plain-image (Bytes)

Cameraman   64.00             32.00                 65536
Peppers    281.00            140.00                589824
Rice        44.00             20.00                 65536

Image      Memory requirement
           Encrypted image (Bytes)

Cameraman  32768
Peppers    14336
Rice       20480
COPYRIGHT 2018 University of the West of Scotland, School of Computing
No portion of this article can be reproduced without the express written permission from the copyright holder.
Copyright 2018 Gale, Cengage Learning. All rights reserved.

Article Details
Printer friendly Cite/link Email Feedback
Author:Oyinloye, Damilare Peter; Gbolagade, Kazeem Alagbe
Publication:Computing and Information Systems
Article Type:Report
Date:Oct 1, 2018
Previous Article:A Comparative Analysis of Feature Selection and Feature Extraction Models for Classifying Microarray Dataset.
Next Article:Development of Iris Biometric Template Security Using Steganography.

Terms of use | Privacy policy | Copyright © 2021 Farlex, Inc. | Feedback | For webmasters |