You are on page 1of 5

# Proceedings of the International Conference on Pattern Recognition, Informatics and Medical Engineering, March 21-23, 2012

Cubical Key Generation and Encryption Algorithm Based on Hybrid Cubes Rotation
D. Rajavel, S. P. Shantharajah
Department of Computer Applications Sona College of Technology Salem, Tamil Nadu, India rajaveld@yahoo.co.in, spshantharaj@gmail.com

Abstract We propose a new cryptographic algorithm based on combination of hybridization and rotation of cubes. Hybridization was performed using magic cubes with m number of n order magic square for the generating hybrid cubes. The obtained hybrid cube was shuffled via rotation square, which in turn generated from randomly selected magic square. Cubic rotation was performed as same that of simple Rubiks cube shuffling. In general, two phase of rotation was carried out, in which first one involves in the rotation of hybrid cube to generate a key and the second one involves in the rotation of original text to give rise a cipher text. The generated key was in cubical form and cipher text generated from this encryption algorithm is more secure from cryptanalysis. Keywords- cryptography algorithm; cubical key; cube rotation; cube hybridizatio.

I.

INTRODUCTION

proposes cubical based encryption and decryption schemes . Feng, Xiao, Tian, Xiaolin, Xia, Shaowei, proposed the cryptographic algorithm for image encryption based on rotation of magic cubes . In this approach three dimensional cubes are generated from two dimensional image pixel values. By rotating the cubes face value, image is encrypted but this approach involves only changes the face values of cube. Sapiee Jamel, Tutut Herawan, and Mustafa Mat Deris, proposed the hybrid cube based cryptographic algorithm . In this approach cube is used only for generation of key, but encryption of message is represented in two dimensional, so cryptanalyst can find the original messages with minimum number of possibilities in comparison to our proposed algorithm. The configuration of Rubiks cube contains several subsets which can be solved by factorization problem. Though, factorization problem is very easy in the case of Rubiks cube but finding the shortest route via factorization is NP-hard [2, 14]. In this study, we propose a new way of generating crypto key and encryption technique using cube rotation and generating hybrid cubes from magic cubes. Generation of number of magic cubes is based on combination of magic squares and two orthogonal Latin squares [15, 16]. The number of magic cube generation is depends on message length and magic cube order. For example: 3 x 3 x 3 magic cube have 192 solutions [17, 18]. Hybridizing n number of magic cubes yields n-1 number of hybrid cubes. After generating several hybrid cubes, a cubical key was selected randomly to avoid cryptanalyst prediction easier. Rotation of cubes are based on rotation square which has the value in the set {1, 2, 3}, depending on these values cube will be rotated. Number of row and column of rotation square depends on order of magic cube. A rotation square was randomly obtained from n number of magic square. Rotation of cube can increase the difficulty to find the original message by increasing the probability and even single rotation of 3 dimensional cubes could reflects on all the faces of cube. This paper is organized as follows: Section 2 describes the basic theory which is used in proposed algorithms. Section 3 describes the proposed key generation algorithm; encryption and decryption algorithm based on rotated hybrid cubes. Section 4 describes the conclusion of this research.

Security is the one of the main aspects in data transfer and data storage. Cryptography plays a major role in security communications, which make use of algorithms to protect sensitive data in a secure manner. In cryptography, key generation is based on mathematical model. Encryption and decryption of original message is based on key value . Very few algorithms like RSA, Quadratic residuosity, Phi-hiding assumption, etc. provides computational hardness  and it makes difficult to break a key by an adversary whose objective is to find the original message. Necessity of cryptography was arrived since World War I to protect information from cryptanalyst. Nowadays, data transfer rate in internet is high, so we have to ensure the secure data transfer. In addition, every cryptographic algorithm must satisfy the execution time and high level security channel according to selection of Advanced Encryption Standard (AES) . Cube based problem provide the computational hardness to find the solution, so cryptanalyst find difficult to arrive with a solution for shuffled cube as because it could produce more possibilities in the form of mathematical functions like exponential and factorial [4, 5]. Cube is a three dimensional object which contains six faces. Data in cube are represented in three dimensional matrixes, for example: 3 x 3 x 3 cube which contain 27 values. Most recent cryptographic algorithm

## International Conference on Pattern Recognition, Informatics and Medical Engineering (PRIME-2012)

II. BASIC THEORY The basic theories which are involved in proposed cryptographic algorithm are explained below. A. Generating Magic Cube Magic cube is a three dimensional integers matrices, arranged in n x n x n pattern. The basic feature of magic cube is that the sum of all numbers in each layers, each column, each row and main space diagonal is equal to single number, this number is called as magic constant of a cube, denoted by M3(n). M (n) = n(n + 1) 2 is based on first row and first column of rotation square. Rotation is performed on alternative row and column coordinates based on row and column index value of rotation square. 4 3 8 9 5 1 2 7 Mod 3 = 6 2 1 1 3

Figure 2. Generate Rotation Square from Magic Square. The first row and first coloumn of the rotation square is highlighted in bold.

III.

PROPOSED ALGORITHMS

According to the theorem stated by M. Trenkler, magic cube can be constructed from the combination of magic square and two orthogonal Latin squares [15, 16]. B. Generating Hybrid Cube Hybrid cubes are generated by matrix multiplication of same layer in between two different magic cubes  which could be easier for a cryptanalyst. But in our approach of hybrid cube generation, multiplication of different layers in magic cubes was carried out. This could decrease the chance of predicting the pattern by the cryptanalyst. Let us consider 3 order hybrid cube layers {1, 2, 3}: hybrid 1 is based on inner matrix multiplication of layer in the different coordinate {i = 1,2,3} of magic cube 1 and layer {i = 3, 2, 1} of magic cube 2 and so on. Hybrid cube 1 is formed from above mention hybrids. Hybrid cube 2 is formed by magic cube 2 and 3, and so on. Example for 3 order hybrid cube: Hybrid cube of order 3 is defined by Hi,j, i in {1, 2, n} and j in {1, 2, 3} defined as Hi,j = Mi,j x Mi+1,k k in {3, 2, 1} where Mi,j is jth layer in ith magic cube. a a a a a a a b a X b a b b b b b b b

A. Cubical Key Generation Algorithm Proposed key generation algorithm produces 3 dimensional hybrid cubical structured key, which is rotated based on rotation square of order n. Rotated hybrid cubical key is presented as follows: Input: M number of magic square and two orthogonal Latin square Output: N-1 number of rotated hybrid cubical keys Step 1: Generation of magic cube We first generate N number of three dimensional n x n x n magic cubes (n>=3, if n=3 then N=192, else N=512) using M number of magic square (M = number of possible magic square, if M>512 then M=512) and two orthogonal Latin square [13, 14]. Step 2: Form hybrid cube The N numbers of magic cubes were subjected to inner matrix multiplication of each layer between two of them to produce N-1 hybrid cubes. Two different magic cubes layer are arranged in following order M1 {1, 2, .., n} and M2 {n, , 2, 1} Step 3: Hybrid cube rotation Randomly selected square from the M number of magic square, in which the values are converted as in a set {1, 2, 3} using modulo of 3. Then rotation was performed on alternative row and column based on rotation square (R). Rotation of ith row in cube was based on ith row and first column index value of R; rotation of jth column in cube was based on first row and jth column index value of R, where i, j in {1, 2 n}. First column was not rotated as the value of R[1,1] was already taken for rotation of first row. Rotation of row was performed from right to left; column rotation was performed from top to bottom side of the cube. The second hybrid cube rotation was based on next randomly selected magic square. Repeat this process until all N-1 hybrid cubes are rotated. Step 4: Generate inverse matrix The resulting rotated hybrid cubes were used to generate the decryption key by the corresponding inverse matrix of rotated hybrid.

## Figure 1. Multiplication of Hybrid cubes first layer Hybrid Cube Rotation

Hybrid cube is rotated based on the rotation square which is formed by performing modulo operation on randomly selected magic square. Definition: Rotation square of order n Rn = [r(i, j): 1 i, j n] and r(i, j) in {1, 2, 3} is a n x n two dimensional matrix which value contain in a set {1, 2, 3}. Rotation square is formed based on modulo of 3 performed with randomly selected magic square. Rotation of hybrid cube

184

## International Conference on Pattern Recognition, Informatics and Medical Engineering (PRIME-2012)

Step 5: Key selection Randomly selected rotated hybrid (n x n x n) cubes was considered as a cubical key. This key is used to encrypt the (n x n x n) message cube. Repeat the selection of key until all messages have their own key to encrypt. Model Implementation Let us consider a 3 order cube to generating encrypt and decrypt cubical key using hybrid cube rotation. Step 1: A 3 order magic square as follows 4 3 8 9 5 1 2 7 6 (1) Step 3: Rotation square for randomly selected magic square, first row and first column of rotation square (bolded value) has been considered for row and column rotation of hybrid cube 4 Magic Square = 3 8 Rotation Square = 9 5 1 2 1 2 7, 6 1 3 (6) 154 HC1 = 414 24 255 HC1 = 1 624 60 HC1 = 414 64 88 171 330 525 196 21 78 171 340 288 50 200 8 729 143 416 50 126 (5)

The two orthogonal Latin squares for 3 orders are given as follows 1 LS1 = 3 2 3 2 1 2 1 1 LS2 = 2 3 3 2 3 1 3 1 2 (2)

We generated magic cube for order 3 with layers has been represented as follows 7 MC1 = 23 12 15 MC1 = 1 26 20 MC1 = 18 4 MC2 3 = 23 16 17 = 1 24 11 9 22 25 14 3 6 19 17 13 9 20 21 14 7 8 19 15 24 10, 8 2 27 , 13 16 5 21 26 10, 6 4 27, 11 12 5 25 (4) (3)

Hybrid cube was rotated based on rotation squares row and column index value to generate encrypt cubical key from (5) and (6) as follows 288 RC1 = 414 416 88 RC1 = 525 78 154 RC1 = 50 60 Step 4: Inverse matrix was generated for all layers in the rotated hybrid cube (7) for decrypt cubical key which should be used in decryption of cipher message as follows 0.001644 IK1 = 0.000738 0.013628 0.003427 IK1 = 0.009410 0.002150 0.005106 IK1 = 0.000979 0.001108 0.001427 0.004404 0.008274 0.002374 0.001263 0.000049 0.002809 0.000344 0.002149 0.002122 0.004894 0.017668 0.000705 0.002114 0.002094 0.005902 0.002227 (8) 0.004634 330 1 255 171 196 171 8 729 340 126 50 64 143 21 624 200 414 24 (7)

MC2

22 MC2 = 18 2

Magic cubes of 192 combinations  are generated using M number of magic square and (2). First and second magic cube is shown in (3) and (4) from 192 combinations. Step 2: Hybrid cube obtained from (3) and (4) are as follows

185

## International Conference on Pattern Recognition, Informatics and Medical Engineering (PRIME-2012)

Based on the key generation algorithm, cubical based unpredictable encrypt cubical key and decrypt cubical key was generated. B. Encryption Algorithm based on Cube Rotation In this encryption technique the hybrid cubical key (See section III-A) and original message was assorted. The resultant mixed message was rotated to produce the cipher text. Input: Original message and N number of rotated hybrid cubical key (n x n x n). Output: N number of cipher text in the form of cubical structure (n x n x n) Step 1: Forming 3 dimensional message Original messages were converted into N number of message cubes (3 dimensional matrixes) with order n and convert each character as 16 bytes integer (Extended ASCII Codes). Step 2: Generate cipher cube Message cube 1 was combined with cubical key 1 to create Message cube 1. Message cube 1 was rotated based on rotation square, which was generated from first layer of cubical key 1 to form cipher cube 1. The rotation was performed by right to left for each row and top to bottom for each column. Step 3: Generate all cipher Repeat the Step 2 until all message cubes are converted into cipher cubes. Model Implementation Let us consider the original message as rajavel love his mom & dad., we using 3 order cubes. So we consider a message containing 27 characters for encryption and decryption. Step 1: The original messages were converted in to 3 x 3 x 3 cubical structure and convert each character in the form of extended ASCII code integer. 114 M1 = 97 108 M1 111 = 32 115 97 118 32 118 104 32 109 32 100 106 101 108 101 105 109 32 100 46 (9) 117086 SC1 = 118804 89280 79596 SC1 = 65606 35422 24464 SC1 = 13452 22698 64747 57883 63212 59380 43811 44576 91229 57632 89316 25998 24586 22120 81375 72280 85133 68094 23248 61904 (10)

Generate the rotation cube from first layer of cubical encryption key (10) which is (RC1i=1 % 3) R2 = 1 3 2 1 (11)

Finally the cipher cube (12) was generated from rotation of semi-cipher cube (10), based on the rotation matrix R2 (11). 25998 C1 = 13452 22698 64747 C1 = 59380 79596 117086 C1 = 23248 68094 63212 65606 35422 57883 43811 57632 81375 72280 91229 61904 24586 89280 85133 44576 89316 22120 118804 24464 (12)

Encryption algorithm generated the unpredictable cubical cipher, which is very difficult to break without cubical key. C. Decryption Algorithm Decryption technique is based on rotation of cipher cubes and then combined with the inverse matrix to get decrypted original message cube. Input: Output: Cipher cubes and cubical decryption key Original message

Step 1: Rotate the cipher cube Cipher cube 1 was rotated based on the rotation square which was created from first layer of inverse matrix of decryption cube to create Message 1, repeat the same step until all the cipher cubes are rotated based on rotation square to create last Message N. The rotation was performed by left to right for each row and bottom to top for each column. Step 2: Decrypt the message Mixing of Message 1 and decryption key 1 will create original message 1, repeat the same step until

111 M1 = 38 97 Step 2:

Generated semi-cipher cube based on mixing of (9) and (7) which is the matrix multiplication product of (9) and (7)

186

## International Conference on Pattern Recognition, Informatics and Medical Engineering (PRIME-2012)

all the original message is generated from decrypted cubes. Step 3: Convert original text from 3 dimensional cubes All the message cubes were converted in to plain text with extended ASCII code. Model Implementation Step 1: Rotation square was generated from first layer inverse matrix of decryption cubical key (8), will be equal to the rotation matrix (11) Rotate the cipher cube (13) based on rotation cube to generate the Message which is equal to semicipher cube (10), in this rotation process inverse rotation is performed in each row and column Step 2: Original message was obtained from the combination of cipher cube (12) and decryption key cube (8) M1 114 = 97 108 111 = 32 115 111 = 38 97 97 118 32 118 104 32 109 32 100 106 101 108 101 105 109 32 100 46
   Li Zhang, Xiaolin Tian, Shaowei Xia, A Scrambling Algorithm of Image Encryption Based on Rubik's Cube Rotation and Logistic Sequence IEEE Explore Multimedia and Signal Processing (CMSP), 2011 International Conference on 14-15 May 2011 On page(s): 312 315 Rajdeep Chowdhury & Saikat Ghosh Normalizer Based Encryption Technique [NBET] Usingthe Proposed Conc ept Of Rubicryption International Journal of Information Technology and Knowledge Management January-June 2011, Volume 4, No. 1, pp. 77-80 Zhi-liang ZHU, Chong WANG, Hua CHAI, Hai YU A Chaotic Image Encryption Scheme Based on Magic Cube Transformation 2011 Fourth International Workshop on Chaos-Fractals Theories and Applications 978-0-7695-4560-8/11 2011 IEEE Xiao Feng, Xiaolin Tian, Shaowei Xia, An Improved Image Scrambling Algorithm Based On Magic Cube Rotation and Chaotic Sequences 2011 4th International Congress on Image and Signal Processing 978-1-4244-9306-7/11 2011 IEEE Jianbing Shen, Xiaogang Jin, and Chuan Zhou, A Color Image Encryption Algorithm Based on Magic Cube Transformation and Modular Arithmetic Operation In: Ho, Y.-S., Kim, H.-J. (eds.) PCM 2005. LNCS, vol. 3768, pp. 270280. Springer, Heidelberg (2005) Zhang, L., Shiming, J., Xie, Y., Yuan, Q., Wan, Y., Bao, G, Principle of Image Encrypting Algorithm Based on Magic Cube Transformation, In: Hao, Y., Liu, J., Wang, Y.-P., Cheung, Y.-m., Yin, H., Jiao, L., Ma, J., Jiao, Y.-C. (eds.) CIS 2005. LNCS(LNAI), vol. 3802, pp. 977 982. Springer, Heidelberg (2005) Feng, Xiao, Tian, Xiaolin, Xia, Shaowei, A novel image encryption algorithm based on fractional fourier transform and magic cube rotation IEEE Explore Image and Signal Processing (CISP), 2011 4th International Congress on 15-17 Oct. 2011 Sapiee Jamel, Tutut Herawan, and Mustafa Mat Deris, A Cryptographic Algorithm Based on Hybrid Cubes, ICCSA 2010, Part IV, LNCS 6019, pp. 175187, 2010 Christophe Petit and Jean-Jacques Quisquater, Rubik's for Cryptographers, UCL Crypto Group, January 19, 2011. M.Trenkler, A construction of magic cubes, The Mathematical Gazette, 84, 3641, March 2000 M.Trenkler, An algorithms for making magic cubes, The Pi Mu Epsilon Journal (USA) 12(2005), 105106 John R. Hendricks, The Third-Order Magic Cube Complete, Journal of Recreational Mathematics 5:1:1972, pp 43-50 W. S. Andrews, Magic Squares & Cubes, 2nd edition, Dover Publ. 1960, pp.69.











M1

##     

M1

Finally without loss of any data decryption algorithm reproduce the original message (9) as well.

IV.

CONCLUSION

Rotation of hybrid cubes was performed here could form a basis for new cryptographic algorithm. Generated encryption key is in 3D cubical form which can increase the possibilities for picking a solution in comparison to a 2-D key. We performed random selection in the case of rotation square generation and selection of encryption key which also makes difficult for predicting the pattern for cryptanalysis.

V.
    

REFERENCES

Stallings William, Stalling Cryptography And Network Security, 4/E 2006 Pearson Education, Inc. Michael R. Garey and David S. Johnson, Computers and Intractability: A Guide to the Theory of NP-Completeness, W.H. Freeman (1979). National Institute of Standards(NIST): FIPS Pub 197: Advanced Encryption Standard AES (2001) David Joyner, Adventures in group theory: Rubik's Cube, Merlin's machine, and other mathematical toys, JHU Press, 2002 Scott Vaughen, Counting the Permutations of the Rubik's Cube, Miami Dade College, unpublished.

187