Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

The rail fence cipher represents a form of transposition encryption, where a pla

ID: 3747581 • Letter: T

Question


The rail fence cipher represents a form of transposition encryption, where a plaintext (i.e., secret message) is written in a zigzag pattern on more than one line, which is referred to as a rail. More specifically, the plaintext is written downwards and diagonally on successive "rails" of an imaginary fence. When the bottom rail is reached, the remainder of the plaintext is written in the same way as above, but upwards. When the top rail is reached, the remainder of the plaintext is written downwards and diagonally again until the bottom rail is reached. Then, the remainder of the plaintext is written upwards and diagonally again until the bottom rail is reached. This pattern repeats until the whole plaintext is written out. To generate the ciphertext, the letters on the first rail are written. Then, those letters on the second rail are written, followed by those on the third rail, if any. This process repeats until those letters located at the last rail are written. 1. Consider the following plaintext message: “WELCOME CSC 312 STUDENTS”. Cipher this plaintext by writing it on a two-rail fence. Show the ciphertext. 2. Consider a three-rail fence. Show the ciphertext. 3. Consider a two-rail fence. Discuss how to decipher a ciphertext to generate the original plaintext. 4. Answer the same question above using a three-rail fence. 5. Assume you have the following ciphertext, which corresponds to a plaintext written on a two - rail fence:
MFVRTSBETSAHYAOIEUJCIMT
Recover the plaintext associated with this cyphertext

Explanation / Answer

Ans 1.

Plain-Text : P = WELCOME CSC 312 STUDENTS

Here len(P) = 24 with white spaces

Key = 2-rail fence

Encryption : Here _ is the white space

So the cipher-text : C = WLOECC32SUETECM S 1 TDNS

Ans 2.

Plain-text : P = WELCOME CSC 312 STUDENTS
Len(P) = 24

Key = 3-rail fence

Encryption : Here _ is the white space

Cipher-Text : C = WOC3SEECM S 1 TDNSLEC2UT

Ans 3. Decryption Process : In two-rail fence:

We will use the cipher-text we generated in the answer 1 as an example to show the decryption process.

Cipher-Text C = WLOECC32SUETECM S 1 TDNS
We first calculate the length of the cipher-text which will be the number of columns of the rail fence. Here the len(C) = 24

And from the key which is 2-rail we know that the number of rows = 2

And since we have a 2 rail-fence so each entry in each row will be in alternate columns thus we will be having like following. We will fill the table as rows.

C = WLOECC32SUETECM S 1 TDNS

So the first row will be

Now we will fill the second row

C = WLOECC32SUETECM S 1 TDNS

Now we will read this rail fence diagonally from the left top untill the bottom then the remainder of the plaintext will be read in the same way but upwards till top rail then again same way.

So the Plain text will be P = WELCOME CSC 312 STUDENTS

Ans 4. Decryption Process : In three-rail fence:

We will use the cipher-text we generated in the answer 1 as an example to show the decryption process.

Cipher-Text : C = WOC3SEECM S 1 TDNSLEC2UT
We first calculate the length of the cipher-text which will be the number of columns of the rail fence. Here the len(C) = 24

And from the key which is 3-rail we know that the number of rows = 3

And since we have a 3 rail-fence so each entry in first row will be after the 3 columns and starting from the 1st column

Cipher-Text : C = WOC3SEECM S 1 TDNSLEC2UT

So the first row will be

Now in the second row the first entry will be at the 2nd column then in the alternate column. So the 2nd row will be

Cipher-Text : C = WOC3SEECM S 1 TDNSLEC2UT

Now in the third row the first entry will be in the 3rd column and then each entry will be after 3 columns. So the third row will be

Cipher-Text : C = WOC3SEECM S 1 TDNSLEC2UT

Now we will read this rail fence diagonally from the left top untill the bottom then the remainder of the plaintext will be read in the same way but upwards till top rail then again same way.

So the Plain text will be P = WELCOME CSC 312 STUDENTS.

Ans 5.

Cipher-Text = MFVRTSBETSAHYAOIEUJCIMT

Key = 2-rail fence

Here len(C) = 23

so the number of columns =23

number of rows = 2

each entry in each row will be in alternate columns thus we will be having like following. We will fill the table as rows.

Cipher-Text = MFVRTSBETSAHYAOIEUJCIMT

so the rail fence will be

Now we will read this rail fence diagonally from the left top untill the bottom then the remainder of the plaintext will be read in the same way but upwards till top rail then again same way.

So the Plain-text : P = MYFAVORITESUBJECTISMATH

W L O E C C 3 2 S U E T E C M _ S _ 1 _ T D N S