Question: write a program in java that can encrypt and decrypt a message using a simple columnar transposition encryption algorithm. For the purposes of this project,

write a program in java that can encrypt and decrypt a message using a simple columnar transposition encryption algorithm. For the purposes of this project, you will only use one step of column transpositions, although for extra credit, you can modify the file to perform two transpositions. The text file will consist of messages; each line will start with either E (encrypt) E5NOWISTHEWINTEROFOURDISCONTENT* or D (decrypt), D6RDIISPITRLHECHDLAAHEBIKRATYAEERHWMSZ*

and a single digit for the number of columns that will be used (or was used) to encrypt the message. Each message will end with *. The encryption works as follows: The message is written to a table of n columns of characters, filling one row at a time. When the message is completely written to the table, any blank spaces in the array will be filled with a character rarely used, such as X, Z, Q. The message is then rewritten by reading the table one column at a time (reading down the columns), giving a permutation of the original message. Your program should output the encrypted message to a text file. The decryption works in reverse: The message is written to a table of n columns of characters, filling one column at a time. (You will need to calculate the number of rows needed to store the encrypted message.) The message should fill the table completely. The message will then be rewritten by reading the table one row at a time (left to right order). The decrypted measure should then be written to a text file.

text file consist of following data

E5NOWISTHEWINTEROFOURDISCONTENT* D6RDIISPITRLHECHDLAAHEBIKRATYAEERHWMSZ* 

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!