In last few years, internet has evolved drastically. People

In
today’s world, internet is one of the biggest platforms where huge amount of
information had been exchanged to fulfil the individual’s objective or purpose.
Due to this overall scenario,
internet has really called for vital security. The increase use of data
transfer via electronic means from one point to the other has an extensive growth in the past
few years. Before the mode of transfer, there are a number of algorithms
available for encrypting data and transportation ciphers are widely used along
with other ciphers to increase the encryption complexity 1. Rail fence cipher is
categorised under data encryption algorithm that uses same key for both
encryption and decryption. The number of rows used to breakup data to be
encrypted into rows and column arrangement serves as the key in rail fence
cipher 3. This paper
proposes an algorithm to implement rail fence transposition cipher in the time
and space complexity of O(n).

 

Keywords: – cipher,
decryption, encryption, rail fence, transposition.

We Will Write a Custom Essay Specifically
For You For Only $13.90/page!


order now

 

Roadmap: – Introduction
and Motivation for Research have been discussed in section 1, the proposed
methodology has highlighted in section 2, the discussion on proposed algorithm
is available in section 3 and finally conclusions are provided in section 4.

 

1.      Introduction and Motivation for Research

In
the last few years, internet has evolved drastically. People use internet for
things like   shopping,   money  
transfer   from   bank  
accounts,   etc. where any kind of
unexpected failure is intolerable, this make the security of data during
transmissions a mandatory need. Earlier the information is transferred from one
system to another via online mode. This network contains all kinds of users,
including those, who want to illegally access or alter the information passed
from sender to receiver. Since this information is very sensitive, we don’t
want it to reach to an unauthorised person. Hence the information is first
converted into an encrypted message and then sent to the receiver. People who
have the decryption algorithm along with the decryption key are the only
authorized people who are able to change that cipher into the readable form.
Being an authorised person means, that user, by sender’s will, has the key to
decrypt the message into readable format.

The conversion of plain message into
cipher text is done in such a way, that there exists a method to reconvert the
cipher into plain or readable message. The field which deals with secure communication
between authorised users, in the presence of third party is called Cryptography. A ciphered text is not an
unbreakable text and there are possibilities that any third party can break it
down to understand it, all this is the matter of the complexity of the cipher
and the key. To make the cipher text more complex to breakdown, it can
be encrypted many times with same or different algorithm 2.

The process of converting the plain or understandable
message into a cipher text with a key, using some algorithm is known as
Encryption. And the reverse process, to change the cipher text into plain text
is called Decryption 4.

 

Figure
1. Encryption and Decryption Mechanism

 

There
are two primary ways to encrypt a message: Substitution Cipher and
Transposition Cipher as highlighted in figure 1. Substitution Ciphers are the
ciphers generated by replacing the characters of the original message with some
other characters generated by some mathematical function whereas the
Transposition ciphers are those ciphers which are generated by interchanging
the positions of the characters of the original message to make it an
unintelligible message 5.

The key plays a vital role in encryption
and decryption, that is, why it must be of sufficient length, so that the
hacker should not easily guess the key to break the cipher down into readable
form. Depending upon the method used for encryption and decryption, the keys
can be divided into two categories: Symmetric keys and Asymmetric keys.

Symmetric key system is the system where
the key used for decrypting the cipher text is same as the key used for encrypting
the plain text. In this system the key must be kept secret or private, that is
why this system is also called as private key system and the system where the
key used for decryption is different than the key used for encryption is called
as Asymmetric key system. This system is also known as Public Key system 6.

 

1.1       Rail Fence Cipher

Rail
Fence cipher is one of the basic transposition ciphers. In this cipher the
plain text is arranged downwards diagonally on successive rails up to the
bottom rail and then arranged moving up with the same pattern up to the top
most rail, this pattern is repeated until every character of the text gets
written on the rails 7. After
arranging the characters in this way, the characters are read from left to
right from each rail one by one, starting from the top most rail.  For instance, if we want to encrypt the
message “TECHNOLOGICAL_INSTITUTE” with 5 rails, then this text must
be arranged in the order shown below in figure 2.

Figure
2. Encryption of Message through Rail Fence Cipher Technique

 

After
the arrangement, the characters are read line by line from left to right to get
the cipher text as: TGSEOINTCLCIIEHOA_TTNLU. In rail fence cipher, the key is
the number of rails chosen for the encryption. It is to be noted that if the
number of rails is greater than the number of characters in the message, then
the cipher text will be same as the input message and if we use lesser number
of rails then the letters in the cipher text will be placed closer to their
actual position, which would make it easier for the third party to guess the
plain text, hence the number of rails should be chosen accordingly.

 

2.      Rail Fence Cipher Algorithm

The
proposed algorithm consists of the steps of instructions needed to be executed
in a computer, in the given sequence to solve a specific problem.  The objective of proposed algorithm is to
encrypt the message in the form of Rail fence cipher so as to reduce the time
complexity. The approach of Rail fence cipher algorithm takes 2 inputs, the
plain text message which is to be encrypted and the number of rails to be used
for encryption, which must be greater than or equal to 2. The overall activity
used in rail fence cipher technique is simplest in its respective domain. This
feature makes the proposed algorithm popular in transformation of plain text or
messages in a very wiser way.

 

2.1       Encryption Algorithm

Function Rail_Fence_Encryption (plain_text,
rail_no)

1      cipher_char ? 1

2      p_len ? length of plain text

3      for i ? 1 to rail_no

4                  flag
? 1

5                  plain_char
? i

6                  while
plain_char  ?  p_len

7                              cipher_textcipher_char
? plain_textplain_char

8                              cipher_char
? cipher_char+1

9                              if
i = 1 or i = rail_no then

10                                         plain_char
? plain_char + (rail_no -1) × 2

11                             else

12                                         if
flag = 1 then

13                                                     plain_char
? plain_char + (rail_no – i) × 2

14                                                     flag
? 0

15                                         else

16                                                     plain_char
? plain_char + ((i -1) × 2)

17                                                     flag
? 1

18                                         end
if

19                             end
if

20                 end
while loop

21     end for loop

 

2.2       Decryption Algorithm

Function Rail_Fence_Decryption (cipher_text,
rail_no)

1      cipher_char ? 1

2      c_len ? length of cipher text

3      for i ? 1 to rail_no

4                 flag
? 1

5                  plain_char
? i

6                  while
plain_char  ?  c_len

7                              plain_textplain_char
? cipher_textcipher_char

8                              cipher_char
? cipher_char+1

9                              if
i = 1 or i = rail_no then

10                                         plain_char
? plain_char + (rail_no -1) × 2

11                             else

12                                         if
flag = 1 then

13                                                     plain_char
? plain_char + (rail_no – i) × 2

14                                                     flag
? 0

15                                         else

16                                                     plain_char
? plain_char + ((i -1) × 2)

17                                                     flag
? 1

18                                         end
if

19                             end
if

20                 end
while loop

21     end for loop

 

3.      Discussion on the proposed Algorithm

The
proposed algorithm converts given plain text into rail fence cipher text by
generating a permutation of the plain text. The outer loop in the algorithm
chooses the rail number, starting from 1, and the inner loop puts the letters
into the cipher and computes the place of the letter of the message which will
be the subsequent letter in the rail chosen by the outer loop, until all the
letters in that rail gets written out. In this way, the algorithm writes the
letters of each rail one after another without actually arranging the letters
of the message in the zigzag pattern as shown in Figure 2.

            The proposed algorithm uses three
formulas as shown in figure 3. The formula ‘X’ is used to find the position of the characters
present in the first and last rail. The formulas ‘Y’ and ‘Z’ are used to
calculate the cipher characters of the intermediate rails. 

Figure
3. Calculation of the placement of characters in rail fence cipher text

 

The Decryption algorithm is just the
reverse of it, the letters from the cipher text are chosen one after another,
and the same steps are preceded as followed in encryption technique. After that
we get the actual position of that letter and it gets placed in its actual position. This is done until
all the letters from the cipher text are arranged to form the original message.

 

3.1       Time Complexity of the
Proposed Algorithm

The number of times outer loop (line 3) gets
executed in terms of the number of rails,

T1  = r + 1  = O(r)

Number of times inner loop
(line 6) gets executed in terms of the number of rails and the number of
letters in each rail,

T2
  =

    = n + r    = O(n)

In the above equations,
‘r’ is the number of rails, ‘n’ is the number of characters in plain text and
‘mi’ is the number of characters in ith rail. The total time complexity of the algorithm
depends on the inner loop (line 6). Hence time complexity of the algorithm can
be given by,

T(n)   =   O(n)

4.         Conclusions

Rail
Fence Cipher is a cipher system that uses same key for both its encryption and
decryption that belongs to the class of transposition cipher called route
ciphers. Encryption key depends on the number of rows used to break down the
message into row and column arrangement to resemble a rail of fence. The proposed
algorithm was designed to show a simple way to develop programs for the
encryption and decryption, using any number of rails. The time and space
complexity of the proposed algorithm is linear, i.e. O(n).

The
future research direction is to find the optimal number of rails for a given
plain text because if the number of rails is small number then the placement of
cipher characters in cipher text will be close to its neighbouring plain text’s
characters whereas if the number of rails is greater than the number of
characters in message then the cipher text will be same as the specified
message.

x

Hi!
I'm Brenda!

Would you like to get a custom essay? How about receiving a customized one?

Check it out