You are on page 1of 5

2015 International Conference on Advances in Computer Engineering and Applications (ICACEA)

IMS Engineering College, Ghaziabad, India

Developing 3D-Playfair Cipher Algorithm Using


Structure Rotation
Swati Singh Amandeep Kaur
Dept. of CSE Dept. of CS
IMS Engineering College NIT Jalandhar
Ghaziabad, India Jalandhar, Punjab (India)
misthu.swati@gmail.com aman8203031@gmail.com

Ravindra Kumar Singh Dilpreet Kaur


Dept. of CS Dept. of CS
NIT Jalandhar NIT Jalandhar
Jalandhar, Punjab (India) Jalandhar, Punjab (India)
ravindra1987singh@gmail.com dilpreett3@gmail.com

Abstract—3D-Playfair cipher is a multiple letter encryption Linear Feedback Shift Registers are good candidate for
cipher. Trigraphs (combination of 3 characters) of the plaintext generating random sequences. Due to its logical circuit
are treated as single unit and converted into corresponding variation and its implementation on software and hardware are
cipher text trigraphs and vice-versa. Classical Playfair Cipher also easy [6].
supports English alphabets with limitation that only one alphabet
“i” or “j” will be considered at a time. 3D-Playfair Cipher came A novel approach of encryption is presented in this paper,
into focus to eliminate this limitation. In addition to that 3D- with moving structure of key matrix on each trigraph
Playfair Cipher also overlooks the limitation of similar fashion processing. A random key will be required for structure
encryption of diagrams and its reverse diagrams. 3D-Playfair movement. So LSFR is used to generate keys for rotations of
cipher supports all 26 English alphabets {A-Z}, 10 digits {0-9} key matrix of 3D-Playfair Cipher in this research. At first
and 28 special characters including { ! “ * # $ % & ‘ + , - . / : ; ( ) plaintext trigraphs will be converted into corresponding
< = > ? @ [ ] \ ^ _ | }. The theme of this research is to enhance the ciphertext trigraphs based on 3D-Playfair cipher rules and then
security of text files that contains alphabets, numerals and special rotated key matrix will be used to process next trigraph.
characters. In this approach we developed a structure rotation
concept on key matrix of 3D-Playfair cipher using random key to
achieve the objective. Random sequences are generated through II. 3D- PLAYFAIR CIPHER
Linear Feedback Shift Register due to its simplicity and better 3D-Playfair cipher is the multiple letter encryption cipher,
performance. and encrypts a trigraph of plaintext into corresponding cipher
text trigraph and vice-versa by using a 4 X 4 X 4 matrix to
Keywords—3D-Playfair cipher; trigraph; rotations; bitwise store twenty-six (26) alphabets, ten (20) numerals and twenty-
operations; LFSR eight (28) special symbols. These letters are arranged in the
matrix by using secret key in the same manner as classical
I. INTRODUCTION playfair cipher. A matrix is represented in below table by
The relationship of security and bitwise operations are very assuming a null key:
casual [2]. A bitwise operation is used to operate on one or
more than one bit patterns or on any binary numerals at the TABLE I. SEQUENCE OF LETTERS IN 3D PLAYFAIR CIPHER
level of their individual bits. Shifting the binary value of any
Floor 1 Floor 2
integer in circular fashion in called rotation, Rotations are
0 1 2 3 G H I J
considered bitwise operations [3], because they operate on the 4 5 6 7 K L M N
binary representation of an integer instead of its numerical 8 9 A B O P Q R
value; however, rotations do not operate on pairs of C D E F S T U V
corresponding bits therefore cannot properly be called bit-wise
[4]. Rotations play crucial roles in data security; it move or Floor 3 Floor 4
shift the position of bits according to the user’s command [5] to W X Y Z - . / :
the left/ right in circular fashion. It is very popular and being ! “ # $ ; < = >
% & ‘ ( ? @ [ \
used in most of the cryptographic algorithms due to its easy
) * + , ] ^ _ |
implementation and fast response.

978-1-4673-6911-4/15/$31.00©2015 IEEE

1004
2015 International Conference on Advances in Computer Engineering and Applications (ICACEA)
IMS Engineering College, Ghaziabad, India

3D-Playfair cipher has 3 main parts Key Matrix generation, fashion. This approach can be better understand by the
Encryption and Decryption. All these parts are better explained following diagram-
in following section [1]-
A. Key-Matrix Generation
3D-Playfair Cipher uses a 4 X 4 X 4 matrix (table) to store TABLE III. ENCRYPTION PROCESS OF 3D PLAYFAIR CIPHER
a keyword that becomes the key for encryption and decryption
process. Storing keyword into 4 X 4 X 4 matrix is based on Plain Text Plain Text Trigraph Cipher Text
given rules- Trigraph 1st Letter 2nd Letter 3rd letter Trigraph
1st Letter Row Column Floor 1st Letter
1. Enter the secret (password) which may contain 2nd Letter Floor Row Column 2nd Letter
numerals, alphabets and special symbols like: 3rd letter Column Floor Row 3rd letter
aman2015nitj@gmail.com, cipher, 29101989,
ravindra_1987_singh@nitj.ac.in etc. Circular fashion means 2nd letter is the next letter and 3rd
letter will be the next-to-next letter for 1st letter. 3rd letter will
2. Drop the duplicate letters of key to get the keyword. Ex: be the next letter and 1st letter will be the next-to-next letter for
amn2015itj@g.com, ravind_1987sgh@tj.c, cipher, 2nd letter and 1st letter will be the next letter and 2nd letter will
29108 for above keys. be the next-to-next letter for 3rd letter.
3. Arrange this keyword in 4 X 4 X 4 matrix floor by
floor, row-wise: left to right and then top-to-bottom. C. Decryption
A letter in the trigraph will be replaced by the letter that
4. Fill all remaining spaces of the matrix with the rest of will lay on the same row of the letter and at the floor of the
numerals (0-9), alphabets (A-Z), special symbols. next letter and the column of next-to-next letter in circular
Ex: if secret is FRIENDS4EVER@NITJ_2012.CSE fashion. This approach can be better understand by the
Then keyword will be FRIENDS4V@TJ_201.C following diagram-
And Key-Matrix is given in the table below:
TABLE IV. DECRYPTION PROCESS OF 3D-PLAYFAIR CIPHER
TABLE II. KEY MATRIX GENERATION
Cipher Text Cipher Text Trigraph Plain Text
Floor 1 Floor 2 Trigraph 1st Letter 2nd Letter 3rd letter Trigraph
F R I E . C 3 5 1st Letter Row Floor Column 1st Letter
N D S 4 6 7 8 9 2nd Letter Column Row Floor 2nd Letter
V @ T J A B G H 3rd letter Floor Column Row 3rd letter
_ 2 0 1 K L M O
Remove the filler letter from the trigraph (Dropping any extra
Floor 3 Floor 4 X and Z that don't make sense in the final message) to find the
P Q U W * + , - actual text (plaintext).
X Y Z ! / : ; <
“ # $ % = > ? [
III. LINEAR FEEDBACK SHIFT REGISTER (LFSR)
& ‘ ( ) \ ] ^ |
Linear Feedback Shift Register is the rotation based
B. Encryption arrangement to produce a random bit and changes its state in
Encryption process will require trigraph (group of 3 letters). each iteration [7]. This state is a linear function of (using XOR
Grouping of letters are following few rules in order to produce and/or inverse–XOR) its previous state which is responsible to
trigraph. generate the random sequence [8]. Here few selected bits are
1. If any two letters are the same or only one letter is left, processed by this function and drive next state along with
add two filler letter X and Z after the first letter in the random bit. These selected bits are considered as “tap” [9] in
trigraph. other words “bit positions that affects next state is known as
tap”. The state Linear Feedback Shift Register at very start is
2. And if any two letter is left, add a filler X after the considered as “seed”. Seed is the initial value (L-bit) of LFSR;
second letter. here L represents the no of register in this arrangement,
So that BALLOON would be treated as {BAL}, {LOX}, generally called “length” [10]. Generated random sequence
{ONX}, and HELLOWORLDS would be treated as {HEL}, will be more dynamic if we frequently change the tap. Thus
{LOW}, {ORL}, {DSX} and MASTI_M.TECH @NITJ.2012 the scenario is illustrated in the figure as follows [8].
would be treated as {MAS}, {TI_}, {M.T}, {ECH}, {@NI},
{TJ.}, {201}, {2XZ}.
A letter in the trigraph will be replaced by the letter that
will lay on the same row of the letter and the column of the
next letter and at the floor of next-to-next letter in circular

1005
2015 International Conference on Advances in Computer Engineering and Applications (ICACEA)
IMS Engineering College, Ghaziabad, India

Symbol Relative Value Binary Value


F 15 0 0 1 1 1 1
Seed R 27 0 1 1 0 1 1
I 18 0 1 0 0 1 0
F D5 D4 D3 D2 D1 D0 O E 14 0 0 1 1 1 0
N 23 0 1 0 1 1 1
D 13 0 0 1 1 0 1
CL S 28 0 1 1 1 0 0
Feedback Symbol, Output Symbol 4 4 0 0 0 1 0 0
V 31 0 1 1 1 1 1
@ 57 1 1 1 0 0 1
X-OR gate Di D flip-flop T 29 0 1 1 1 0 1
J 19 0 1 0 0 1 1
Fig. 1. LFSR for Tap = [0, 1, 2, 4], length (L) = 6 _ 62 1 1 1 1 1 0
2 2 0 0 0 0 1 0
Linear feedback shift register can be better explained by 0 0 0 0 0 0 0 0
bellow algorithm. We first need to understand few basic terms 1 1 0 0 0 0 0 1
. 49 1 1 0 0 0 1
related to this arrangement.
C 12 0 0 1 1 0 0
X-OR 1 0 0 0 1 0
A. Basic Terms
Some basic terms required for linear feedback shift Seed: {100010}
register- 4) Tap: Tap depends upon the keyword. Bit position of 1
1) Length of Seed (L): Length of seed in LFSR is totally in the binary value of keyword’s first letter’s relative value
depends on the number of letters exist in that number system. is called Tap.
If there are total N letters in any number system then it will Ex: Tap for keyword FRIENDS4V@TJ_201.C
need “L” registers. It can be calculated by-
a) First letter: F
b) Relative value: 15
2L >= N > 2L-1 (1)
c) Binary value: 001111
Ex: Length of seed in 3D-Playfair cipher will be 6 because d) Tap = {0, 1, 2, 3}
(26 >= 64 > 25).
B. Algorithm
2) Relevant Values: A relevant value is assigned to all
letters exist in the number system [11]. 3D-Playfair cipher This algorithm will provide the general steps to produce
random output symbols -
contains 64 letters, so its relevant values of its letter will be:
___________________________________________________------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ ----------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------- --

TABLE V. RELATIVE VALUES OF LETTER Algorithm 1:


___________________________________________________--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------- -----

0 1 2 3 4 5 6 7 LFSR (LFSR[L], Tap[T], Seed[L], t, l, w, i, j, k)


0 1 2 3 4 5 6 7
8 9 A B C D E F
This algorithm is used to generate the random Output Symbols
8 9 10 11 12 13 14 15 by using Seed[L] and Tap[T], T represents the length of Tap
G H I J K L M N and L represents the length of Seed. LFSR is a linear array of
16 17 18 19 20 21 22 23 L length for storing the next Seed and OS is a linear array for
O P Q R S T U V storing the Output Symbols.
24 25 26 27 28 29 30 31
W X Y Z ! “ # $ _________________________________________________
32 33 34 35 36 37 38 39 1 {
% & ‘ ( ) * + , 2 w = 0;
40 41 42 43 44 45 46 47 3 for (i = 0 to T)
- . / : ; < = >
48 49 50 51 52 53 54 55
4 {
? @ [ \ ] ^ _ | 5 j=Tap[i];
56 57 58 59 60 61 62 63 6 w = X-OR (w , LFSR[ j]);
7 }
3) Seed: Seed sequence is totally depends upon the 8 OS[k]=LFSR[0];
keyword. X-OR value of keyword’s relevant values stores in 9 for (i = 1 to L-1)
first come first serve manner by removing duplicates is called 10 {
Seed. 11 LFSR[i-1]=LFSR [i];
TABLE VI. SEED FOR KEYWORD FRIENDS4V@TJ_201.C 12 }
13 LFSR[L-1] = w;

1006
2015 International Conference on Advances in Computer Engineering and Applications (ICACEA)
IMS Engineering College, Ghaziabad, India

14 k = k + 1; ciphertext trigraph using 3D-Playfair rules. After each trigraph


15 } until (Seed gets repeated); encryption key matrix will be rotated using LFSR key.
__________________________________________________ Decryption process is the reverse of encryption process. After
each trigraph decryptions the structure of key matrix (3D-
Output symbols for keyword FRIENDS4V@TJ_201.C is Playfair matrix) will be rotated using the LFSR key and then
given below- decryption process of 3D-Playfair will be applied to decrypt
the ciphertext.
0, 1, 0, 0, 0, 1, 1, 1, 1, 0, 1, 0, 1, 1, 0
V. ANALYSIS OF PROPOSED METHOD
IV. 3D-PLAYFAIR CIPHER WITH ADDITIONAL BITWISE
3D- Playfair encryption with key FRIENDS4V@TJ_201.C
OPERATION
is demonstrated in this example:
There are 64 letters in 3D-Playfair Cipher that allow 64 X Plaintext: CSE@NITJ
16 X 4 = 4096 possible unique matrix to work with. It is
difficult enough to identify the particular structure but it may Trigraph: {CSE}, {@NI}, {TJX}
be cracked with text by known plaintext attack method.
A. Encryption- (According to Table II: initial key matrix)
Structure rotation of 3D-Playfair matrix will reduce this TABLE VIII. ENCRYPTION OF CSE
drawback up to an acceptable limit by hiding the actual
structure from the intruder [12]. Plain Text Plain Text Trigraph Cipher Text
Trigraph C S E Trigraph
Structure rotation may be achieved using Left/Right
C Row Column Floor I
rotation on the key matrix using LFSR key. LFSR key can be S Floor Row Column 9
generated through Linear Feedback Shift Register by E Column Floor Row R
combining six symbols (generate random sequences of LFSR).
For example if there are N output symbols were generated then TABLE IX. STRUCTURE ROTATION (TABLE II) WITH LFSR KEY: 17,L(1ST KEY)
groups will be (1)(2)(3)(4)(5)(6), (2)(3)(4)(5)(6)(7),... (N-5)(N-
4)(N-3)(N-2)(N-1)(N), (N-4)(N-3)(N-2)(N-1)(N)(1), ... Floor 1 Floor 2
(N)(1)(2)(3)(4)(5). Digital value of these six bits will be used ) * + , | F R I
as the LFSR key for structure rotation of 3D-Playfair matrix. - / : ; E N D S
Here we will apply left or right rotation on the 3D-Playfair < = > ? 4 V @ T
[ \ ] ^ J _ 2 0
matrix based on the count of 1’s in LFSR key. If the number of
1’s are even then we apply left rotation otherwise right Floor 3 Floor 4
rotation. 1 . C 3 O P Q U
TABLE VII. KEY TABLE OF LFSR FOR KEYWORD FRIENDS4V@TJ_201.C 5 6 7 8 W X Y Z
(LFSR Output Symbol: 0, 1, 0, 0, 0, 1, 1, 1, 1, 0, 1, 0, 1, 1, 0.) 9 A B G ! “ # $
LFSR Output Symbols Odd / Even Digital Value Key H K L M % & ‘ (
0 1 0 0 0 1 Even 17 17, L TABLE X. ENCRYPTION OF @NI
1 0 0 0 1 1 Odd 35 35, R
0 0 0 1 1 1 Odd 7 7, R Plain Text Plain Text Trigraph Cipher Text
0 0 1 1 1 1 Even 15 15, L Trigraph @ N I Trigraph
@ Row Column Floor V
0 1 1 1 1 0 Even 30 30, L N Floor Row Column S
1 1 1 1 0 1 Odd 61 61, R I Column Floor Row R
1 1 1 0 1 0 Even 58 58, L
1 1 0 1 0 1 Even 53 53, L TABLE XI. STRUCTURE ROTATION (TABLE IX) WITH LFSR KEY:35,R (2ND KEY)
1 0 1 0 1 1 Even 43 43, L
Floor 1 Floor 2
0 1 0 1 1 0 Odd 22 22, R 3 5 6 7 U W X Y
1 0 1 1 0 0 Odd 44 44, R 8 9 A B Z ! “ #
0 1 1 0 0 1 Odd 25 25, R G H K L $ % & ‘
M O P Q ( ) * +
1 1 0 0 1 0 Odd 50 50, R
1 0 0 1 0 0 Even 36 36, L Floor 3 Floor 4
0 0 1 0 0 0 Odd 8 8, R , - / : I E N D
; < = > S 4 V @
? [ \ ] T J _ 2
Here L represents Left Rotation and R represents Right ^ | F R 0 1 . C
Rotation.
In 3D-Playfair Cipher with Structure Rotation, a trigraph TABLE XII. ENCRYPTION OF TJX
will be extracted from plaintext and will be converted in
Plain Text Plain Text Trigraph Cipher Text

1007
2015 International Conference on Advances in Computer Engineering and Applications (ICACEA)
IMS Engineering College, Ghaziabad, India

Trigraph T J X Trigraph VI. CONCLUSION


T Row Column Floor %
J Floor Row Column _ 3D-Playfair cipher provides high rate of confusion and
X Column Floor Row I diffusion rate, there is 64 X 16 X 4 = 4096 possible trigraph so
it is too hard to apply brute force attack on it. It works on 64
Ciphertext: I9RVSR%_I characters so the probability of occurrence of a character in
3D-Playfair matrix is 1/16 * 1/4 = 1/64 = 0.0156. But still it
Ciphertext will be transmitted over communication medium. may be cracked if there is enough text by known plaintext
B. Decryption - (According to Table II: initial key matrix) attack method because structure of key matrix is fixed but
involvement of structure rotation reduces this drawback up to
Receiver will decrypt the ciphertext using the shared key an acceptable limit by hiding the actual key matrix from the
(same key used by the sender). intruder. 3D-Playfair Cipher with structure rotation will
improve the security using dynamic key matrix. Using LFSR to
TABLE XIII. DECRYPTION OF 19R generate random numbers helps to maintain the complexity of
the proposed approach because the implementation of LFSR is
Cipher Text Cipher Text Trigraph Plain Text easy, cheap and fast in comparison with other methods.
Trigraph I 9 R Trigraph
I Row Floor Column C
9 Column Row Floor S
R Floor Column Row E REFERENCES
[1] Amandeep Kaur, Harsh Kumar Verma and Ravindra Kumar Singh.
Now Structure of (Table II) will be rotated with LFSR key: Article: 3D(4 X 4 X 4) - Playfair Cipher. International Journal of
17, L (1st Key). This table is already shown in Table IX. Computer Applications 51(2): 36-38, August 2012.
[2] William Stallings, Cryptography and Network Security Principles and
TABLE XIV. DECRYPTION OF VSR Practice. Second edition, Pearson Education.
[3] Schnier B, Applied cryptography: protocols, algorithms and source code
Cipher Text Cipher Text Trigraph Plain Text in C. New York: John Wiley and sons, 1996.
Trigraph V S R Trigraph [4] Keith Harrison, Bill Munro and Tim Spiller, Security through
V Row Floor Column @ uncertainty. P Laboratories, February, 2007.
S Column Row Floor N [5] Behrouz A. Forouzan, Cryptography and Network Security. Special
R Floor Column Row I Indian Edition, The McGraw- Hill companies, New Delhi, 2007.
[6] P. Alfke, "Efficient Shift Registers, LFSR, Counters, and Long Pseudo-
Now Structure of (Table IX) will be rotated with LFSR key: Random Sequence Generators, "XAPP 052, July 7,1996 (Version 1. 1)
35, R (2nd Key). This table is already shown in Table XI. [7] Krishnaswamy S, Pillai H K, "On the Number of Linear Feedback Shift
Registers With a Special Structure", ISSN : 0018-9448, IEEE @ 27
TABLE XV. DECRYPTION OF %_I February 2012
[8] Murali P, Senthilkumar G, "Modified Version of Playfair Cipher Using
Linear Feedback Shift Register", Print ISBN: 978-0-7695-3595-1, IEEE
Cipher Text Cipher Text Trigraph Plain Text
@ 19 June 2009
Trigraph % _ I Trigraph
% Row Floor Column T [9] "Linear Feedback Shift Registers", Available at : http://homepage. mac.
_ Column Row Floor J com/afj/lfsr. html.
I Floor Column Row X [10] "Linear feedback shift register ", Wikipedia [online], Available at:
http://en. wikipedia. org/wiki/Linear_feedback_shift_ register. html.
Trigraph: {CSE}, {@NI}, {TJX} [11] The Art of Electronics, 2nd Edition, Horowitzand Hill, 1989, pp. 665-
667
Plaintext: CSE@NITJ [12] Dan Healy, "Understanding Linear Feedback Shift Registers – The Easy
Way", Yikes [online], Available at : http://www. yikes.
com/~ptolemy/lfsr_web/index.html.

1008

You might also like