Write a program that can encrypt and decrypt a message


Your project is to write a program that can encrypt and decrypt a message using a double 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) or D (decrypt), and 2 digits for the numbers of columns that will be used (or were 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.

The process is then repeated using the second digit 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.

Your program should read the message into a string, store it in "appropriate" two-dimensional arrays (one for each step), and then write the resulting string to a new text file.

Request for Solution File

Ask an Expert for Answer!!
Computer Engineering: Write a program that can encrypt and decrypt a message
Reference No:- TGS02903629

Expected delivery within 24 Hours