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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started