Answered step by step
Verified Expert Solution
Question
1 Approved Answer
In java, please The Caesar cipher we discussed in class is an example of a substitution cipher, because the cyphertext is computed by substituting letters
In java, please
The Caesar cipher we discussed in class is an example of a substitution cipher, because the cyphertext is computed by substituting letters in the plaintext. For instance, in a Caesar cipher with a shift of 3, 'A' in the plaintext is replaced by 'D' in the cyphertext, 'B' is replaced by 'E', 'C' is replaced by 'F', and so on. Another type of cipher is a transposition cipher. In this type, the cyphertext is computed simply by rearranging the letters of the plaintext. No substitution is made. Consider the following transposition cipher, called a rail fence cipher. To encrypt a plaintext using a rail fence cipher, you write the plaintext in a zigzag pattern using a specified number of "rails." The cyphertext is then what you get when you read the rails left-to-right, top-to-bottom. Example: Use the rail fence cipher to encrypt the message THIS IS so EASY with 5 rails. Start by rewriting the letters in a zigzag pattern, using 5 rails: Now the cyphertext is what you get when you read the rails left-to-right, top-to-bottom: TEHOAISSSSYI Write a method encrypt Rail Fence (String plaintext, int num Rails) that uses the rail fence cipher to encrypt the plaintext with the specified num Rails and returns the resulting cyphertext. Convert your plaintext into capital letters before encrypting it, and disregard any non-letter characters in the plaintext (i.e., the cyphertext should include only the A-Z characters from the plaintext). Be sure to test your method well - it should work for any plaintext and any positive number of rails. Using num Rails = 1 will simply make the cipher return the capitalized plaintext (with non-letter characters removed). Using num Rails >= plaintext. length() will also have the same resultStep 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