# INTRODUCTION ommunication involves conveying the information in one form or other to the intended receiver, using some medium. Internet, the fastest and most widely used medium of electronic information exchange, is also used for the same. However for the security of information, a technique of data encryption/ decryption is used in most of the cases. # II. # CIPHER Cipher is a message written in a secret code. In a cryptographic system some specific units of plaintext, usually letters, are arbitrarily transposed or substituted according to a predetermined code (encoding technique) to convert it to a cipher text [1]. # Fig.1 : Encoding The ciphertext is then transferred over the nonsecure medium of communication and received by the receiver. The receiver then applies the decoding technique in accordance to the encoding technique to get the actual plaintext communicated to him by the sender. # Fig. 2 : Decoding The basic idea behind any cryptographic algorithm is same, using confusion and diffusion to change the actual information so that it is only the intended user who can decode and understand it. Some World War II ciphers using stuttered rotors are briefly described as natural predecessors [5]. There have been algorithms like the Hill Cipher and Vernam Cipher to the DES, AES and A5 algorithms in the literature [1]. The strength of these ciphers depends upon key length, processing and the use of operations like simple negation, shift, XOR and substitution [8]. # III. 3D ARRAY BLOCK CIPHER PROBLEM We have developed an algorithm which encrypts/decrypts the information in the paper titled "A cipher based on 3D Array Block Rotation". We have suggested the use of Plate-wise rotation along X/Y/Z axis, at random, for the diffusion of the bits/text contained in the 3D Array. However, we have noticed that if such a rotation is performed then there is relative bit/char positioning (red dots), equidistant from the centre (magenta dot) in case of odd sized 3D array (see Fig. 3). This relative bit/char positioning can be exploited for decoding of ciphertext produced using 3D Array Rotations as suggested in previous paper. In our current paper, we discuss introduction of circular shift operation, which will remove this positional dependency problem in the 3D Array. # OUR IMPROVED ALGORITHM In this new version of our cipher based on 3D Array we are proposing the details of key length, number of rounds; which is some multiple of 8, the structure and its two kinds of rotations, the rotation policy as per the sub-keys, k-th iteration details and the overall encryption process shown through various figures and flowcharts. a) The 3D Array Structure We are proposing that the cipher can use a key of length, 8 X Number of Rounds, minimum of 256 bits which will be sufficient to encrypt 4096 data bits. The key may be produced by using some one time pad so that there is a different ciphertext of the same plaintext each time encoding is done. The key can also be generated at the receiver end using agreed upon Random Number Generator or communicated using some highly secure algorithm before transferring the actual data. We can use a three dimensional array to store the initial plaintext. The plaintext may also be stored as row-major/column major fashion, as agreed between the sender and receiver. Considering the three axis as the axis of rotation, X, Y and Z, as shown in Fig. 4, and each layer as a rotatable plate. We can diffuse the text using clockwise rotation of 90/180/270° of particular plate at a particular axis or using linear shift rotation of the rows of the particular plate. A three dimensional matrix may be used to store the initial plaintext. There will be three possible axis of rotation as shown in Fig. 4, and axis-wise layers, as shown in Fig. 5, as a rotatable plate as seen from the three different axis of rotation X, Y and Z respectively. # c) Operations Diffusion of the text can be done using clockwise rotations (see Fig. 6) or shifting of elements of the plate (see Fig. 7) using clockwise/circular left shift rotations of a particular plate in a particular axis of rotation as per criteria defined below. The rotations can be done using a key of 512 bits for 64 rounds cipher. We may also have variable number of rounds by taking key of appropriate number of bits. Each 8 bits from the LSB side can be used to rotate once. Consider 8 bits as shown: # ovember N The Plate Number which is to be rotated is straight forward usage of the 4 bits-1, 2, 3, 4 of the subkey, whose value indicates the plate number which is to be rotated. In case of 5-6 bits to be 11, we will rotate in order of X, Y and Z axis, taking 5678 bit value number. The Rotation policy/Number of Rotations can be decided by using 5, 6 bits of the sub-key calculated as described in Table 2: Similarly, bits 7, 8 of the sub-key can be used to decide the Axis of rotation. The two bits can be used for four possible types of selections represented by 00, 01, 10 and 11 as described in Table 3. The entire encryption process may be converted to a finite number of iterative steps. The encryption can be represented by the flowchart with niterations as shown in Fig. 8. It uses the subkey of 8 bit length and identifies the type of rotation to be performed and then do the rotations as described in iteration detail flowchart. Next iteration is carried out on the intermediate ciphertext produced in the previous iteration. This process is repeated n number of times to complete the encryption process. # Fig. 8 : Encryption Process Similarly, the decryption process is carried out exactly in the reverse manner, i.e. the n-th subkey is used first to reverse rotate the plate (in anti-clockwise direction or circular shift right rotation) and thereby obtaining the Intermediate Ciphertext (n-1). The reverse process is to be carried out for the same number of iterations with the same subkeys in reverse order as done in the encryption process. After completion of the n iterations in reverse order, we will obtain the original plaintext, refer Fig. 9. # EXPERIMENTATION In order to check the goodness of the improved cipher, we conducted lab experimentations on data in which the plaintext contained two halves, first containing all 0s and second containing all 1s. We have used Turbo C's Random Number Generator to take our keys of desired lengths. Here it is noteworthy that Turbo C's random number generator is not very good RNG. The Initial set of bits taken in the proposed ciphering technique used equal number of 0s and 1s. After enciphering using the above mentioned revised technique, we tested randomly selected 1000 bits for tests of Randomness from NIST specifications. The various tests selected for use by us vary in their importance and hardness as randomness tests [4]. Randomness in the block ciphers is considered as an important aspect of its security. One may apply various tests to ensure that cipher can work like a Random Number Generator (RNG) [7]. # a) Monobit Test In order to determine the number of 0s and 1s in the randomly selected bits after enciphering is approximately the same in proportion or not. If the resultant sequence becomes a random sequence, then arbitrarily selected bits must have approximately equal proportion of 0s and 1s. The focus of the test is the proportion of zeroes and ones for the entire sequence. The test assesses the closeness of the fraction of ones to ½, that is, the number of ones and zeroes in a sequence should be about the same. Result: Arbitrarily selected bits sequences from different length ciphers were selected for the Monobit tests and p-values show (Table 4) that all the tests were passed. # b) Frequency within a Block Another test of randomness tests the frequency of bits within a block. The focus of this test is on proportion of 1s within M-bit blocks. The purpose of this test is to determine whether the frequency of 1s in an Mbit block is approximately M/2. Our improved algorithm gave p-values as shown (Table 5) for this test. # Result: The p-values for this test also show that 100% of the random selected blocks from the encrypted sequence passed all the tests, which is a good improvement. # c) Run Test The focus of this test is the total number of runs in the sequence, where a run is an uninterrupted sequence of identical bits. A run of length k consists of exactly k identical bits and is bounded before and after with a bit of the opposite value. The purpose of the runs test is to determine whether the number of runs of ones and zeros of various lengths is as expected for a random sequence. The test was applied to 10 randomly selected sequences of the encrypted data for which the p-values (Table 6) below. We implemented our improved algorithm in C, on a data input of the size 16X16X16 = 163 array upto 32X32X32=323 array. Subsequences from the resultant NOTE: The code for the decrypting process will need the lastAxisOfRotationCounter value and the key. The key will be read in reverse order i.e. starting from 8 LSBs if encryption started from the 8 MSBs. # ovember N d) Random Excursions Test The focus of this test is the number of cycles having exactly K visits in a cumulative sum random walk. The cumulative sum random walk is derived from partial sums after the (0,1) sequence is transferred to the appropriate (-1, +1) sequence. A cycle of a random walk random that begin at and return to the origin. The purpose of this test is to determine if the number of visits consists of a sequence of steps of unit length taken at # VII. ANALYSIS The above algorithm assumes a pre-requisite of having a good unique generating function for random numbers based on a seed value, the results show that the cipher based on the 3D matrix rotation technique works good and implements confusion/diffusion technique very effectively. This 3D Block ciphering technique can be used in everyday encryption/ decryption as it is having good encrypting/decrypting efficiency too. # VIII. COMPLEX FORMS The reverse computational complexity of the proposed cipher for the interceptors and intruders can be further increased by introduction of XOR round before applying rotation in case of binary input plaintext. This can be done by making use of some agreed upon random number generator which generates unique 8 bit sequences with use of a seed. The generated bits can be XORed with some selected subset of the plate under operation. This will further increase the complexity of the cipher further and will be difficult to decrypt by the interceptors. # IX. CONCLUSIONS The above tests show a high rate of randomness of the bits shuffled using the improved technique. Also since the bits were initially divided in equal numbers in the two halves of the array, this shows that the cipher produces a good confusion-diffusion. It only requires an agreed upon RNG or Key for encryption-decryption. Although the new cipher can have variable number of keys used while encrypting the message, we recommend at least 2n iterations for n size array of input bits/text. 3![Fig.3 : Relative bit/char positioning around the centre of 3D Array](image-2.png "Fig. 3 :") ![](image-3.png ".") 4![Fig. 4 : The Structure.](image-4.png "Fig. 4 :") ![b) Axis-wise Plates of 3D Array The Axis-wise plates of a 3X3X3 Array of integers is shown in Fig 5.](image-5.png "") 5![Fig. 5 : Axis-wise Plates view for a 3X3X3 Array](image-6.png "Fig. 5 :") 67![Fig. 6 : Clockwise rotation of Plate 1 along Z-Axis](image-7.png "Fig. 6 :Fig. 7 :") 12![PlaintextRotate i-th plate along X/Y/Z axis by 90/180/270 degrees OR all rows of plate by some positions as specified by 8 bit subkeyIntermediate CiphertextRotate j-th plate along X/Y/Z axis by 90/180/270 degrees OR all rows of plate by some positions as specified by 8 bit subkey Intermediate Ciphertext Rotate k-th plate along X/Y/Z axis by 90/180/270 degrees OR all rows of plate by some positions as specified by 8 bit subkey Ciphertext Rotate k-th plate along X/Y/Z axis by 90/180/270 degrees OR all rows of plate by some positions as specified by 8 bit subkey Intermediate Ciphertext n-1 2011 November](image-8.png "? 1 2") 910![Fig. 9 : Decryption Process](image-9.png "Fig. 9 :`Fig. 10 :") 2Bit Value Rotation TypeClockwise/ShiftLeft Rotations003D circular rotation 90°013D circular rotation 180°103D circular rotation 270°113D circular shift leftThe number of shiftsrotationis decided by 5678bits combination 3Bit Value Axis of Rotation00X01Y10Z11X/Y/Z in rotation starting from X axise) Encryption-Decryption Process 1 4S Nop-value10.23013920.0718613140.23013950.54850660.3173117180.42371190.317311101 5Test Numberp-value10.59667720.2193430.68847440.1492350.27667760.7547270.36966880.82942590.428474100.908275 6Test No p-ValueTest of Randomness10.622762596PASS20.161513387PASS30.505676771PASS40.333302675PASS50.363302144PASS61PASS70.790469891PASS80.011561519PASS90.230139469PASS100.613523364 PASSResult: All the ten tests have passed. © 2011 Global Journals Inc. (US) Global Journal of Computer Science and Technology Volume XI Issue XIX Version I Here we present the pseudo-code of the algorithm in C. The code contains the major steps to be executed in which it reads the plaintext from a file and encrypt to a ciphertext in the file named out. The algorithm was executed several times to take some arbitrary selected bit lengths for inputs to the NIST tests. //here we can put code for sliding each row of plate k of X axis for(i=0; i