Question

In: Computer Science

research the Caesar Cipher, and document your research in 2-3 pages in a Word document with...

research the Caesar Cipher, and document your research in 2-3 pages in a Word document with illustrations in your document and provide an example of how the Caesar Cipher works while encrypting and decrypting a sample message. Also, add its history and its internal workings.

Summary of the areas to complete:

- Research the Caesar Cipher.

- Show its Encryption Method in details.

- Show its Decryption Method in details.

- Describe its History and what it was used for.

- Describe its Algorithms in details.

- Add Graphical Illustrations of its algorithms.

- Give an Example for Encrypting and Decrypting a text message.

- Write a Java, C/C++, or Python code and run it to complete the example message.

Solutions

Expert Solution

The Caesar Cipher technique is one of the earliest and simplest method of encryption technique. It’s simply a type of substitution cipher, i.e., each letter of a given text is replaced by a letter some fixed number of positions down the alphabet. For example with a shift of 1, A would be replaced by B, B would become C, and so on. The method is apparently named after Julius Caesar, who apparently used it to communicate with his officials.
Thus to cipher a given text we need an integer value, known as shift which indicates the number of position each letter of the text has been moved down.

More complex encryption schemes such as the Vigenère cipher employ the Caesar cipher as one element of the encryption process. The widely known ROT13 'encryption' is simply a Caesar cipher with an offset of 13. The Caesar cipher offers essentially no communication security, and it will be shown that it can be easily broken even by hand.


The encryption can be represented using modular arithmetic by first transforming the letters into numbers, according to the scheme, A = 0, B = 1,…, Z = 25. Encryption of a letter by a shift n can be described mathematically as.


(Encryption Phase with shift n)


(Decryption Phase with shift n)

Example:

Text : ABCDEFGHIJKLMNOPQRSTUVWXYZ
Shift: 23
Cipher: XYZABCDEFGHIJKLMNOPQRSTUVW

Text : ATTACKATONCE
Shift: 4
Cipher: EXXEGOEXSRGI

For Caesar cipher code in various programming languages, see the Implementations page.

To encipher your own messages in python, you can use the pycipher module. To install it, use pip install pycipher. To encipher messages with the Caesar cipher.

Cryptanalysis is the art of breaking codes and ciphers. The Caesar cipher is probably the easiest of all ciphers to break. Since the shift has to be a number between 1 and 25, (0 or 26 would result in an unchanged plaintext) we can simply try each possibility and see which one results in a piece of readable text. If you happen to know what a piece of the ciphertext is, or you can guess a piece, then this will allow you to immediately find the key.

If this is not possible, a more systematic approach is to calculate the frequency distribution of the letters in the cipher text. This consists of counting how many times each letter appears. Natural English text has a very distinct distribution that can be used help crack codes.

Java Code to run Ceaser Cipher Encryption and Decryption:

package com.sanfoundry.setandstring;
 
import java.util.Scanner;
 
public class CaesarCipher
{
    public static final String ALPHABET = "abcdefghijklmnopqrstuvwxyz";
 
    public static String encrypt(String plainText, int shiftKey)
    {
        plainText = plainText.toLowerCase();
        String cipherText = "";
        for (int i = 0; i < plainText.length(); i++)
        {
            int charPosition = ALPHABET.indexOf(plainText.charAt(i));
            int keyVal = (shiftKey + charPosition) % 26;
            char replaceVal = ALPHABET.charAt(keyVal);
            cipherText += replaceVal;
        }
        return cipherText;
    }
 
    public static String decrypt(String cipherText, int shiftKey)
    {
        cipherText = cipherText.toLowerCase();
        String plainText = "";
        for (int i = 0; i < cipherText.length(); i++)
        {
            int charPosition = ALPHABET.indexOf(cipherText.charAt(i));
            int keyVal = (charPosition - shiftKey) % 26;
            if (keyVal < 0)
            {
                keyVal = ALPHABET.length() + keyVal;
            }
            char replaceVal = ALPHABET.charAt(keyVal);
            plainText += replaceVal;
        }
        return plainText;
    }
 
    public static void main(String[] args)
    {
        Scanner sc = new Scanner(System.in);
        System.out.println("Enter the String for Encryption: ");
        String message = new String();
        message = sc.next();
        System.out.println(encrypt(message, 3));
        System.out.println(decrypt(encrypt(message, 3), 3));
        sc.close();
    }
}

Note: If you have any related doubts, queries, feel free to ask by commenting down below.

And if my answer suffice your requirements, then kindly upvote.

Happy Learning


Related Solutions

Prepare a short Word document (2 pages) that describes your impressions about the importance of the...
Prepare a short Word document (2 pages) that describes your impressions about the importance of the security mechanisms you have reviewed thus far (authentication, encryption, firewalls, and so on) and how they might be useful in the Group Project
Write a document providing instructions or procedures for your workplace. This should be 2-3 pages in...
Write a document providing instructions or procedures for your workplace. This should be 2-3 pages in length and focus on the written presentation to the audience. Instructions should provide a step-by-step path to accomplishing something. This could be operating, maintenance, use, or other activity requiring direction. Another idea would be product use. You may want to include safety items as you proceed or even materials required at the start or during the steps. Both the text and the web provide...
Problem 2: Caesar Cipher Decryption] Write a python method that takes two parameters: A parameter of...
Problem 2: Caesar Cipher Decryption] Write a python method that takes two parameters: A parameter of type str and a parameter of type int. The first parameter is the plaintext message, and the second parameter is the encryption key. The method strictly does the following tasks: a. Reverse the operations performed by the encryption method to obtain the plaintext message. The method’s header is as follows: def casesardecryption(s, key):
In C++, write a program to implement the Caesar Cipher for both encryption and decryption. The...
In C++, write a program to implement the Caesar Cipher for both encryption and decryption. The program should be able to handle different keys by deciding the key at run time. Thank you :)
Create a WORD (or Pages) doc. Upload either your Word doc or convert Word or Pages...
Create a WORD (or Pages) doc. Upload either your Word doc or convert Word or Pages to PDF and then upload the PDF file below. Do NOT upload a Pages document. A firm produces a product with the following costs: $1.30 of materials and $0.90 of wages for factory labor. In addition, the firm also pays rent of $483 and insurance of $242 per month. Its past few statements for electricity had the following total costs: Cost of Electricity Month...
Caesar Cipher Encryption] Write a method that takes two parameters: A parameter of type str and...
Caesar Cipher Encryption] Write a method that takes two parameters: A parameter of type str and a parameter of type int. The first parameter is the plaintext message, and the second parameter is the encryption key. The method strictly does the following tasks: a. Convert the string into a list (let us refer to it as lista). An element in the generated list is the position of the corresponding letter in the parameter string in the English alphabet. Example: ‘C’...
Write a document providing instructions or procedures for your workplace. This should be 2-4 pages in...
Write a document providing instructions or procedures for your workplace. This should be 2-4 pages in length and focus on the written presentation to the audience. Instructions should provide a step-by-step path to accomplishing something. This could be operating, maintenance, use, or other activity requiring direction. Another idea would be product use. You may want to include safety items as you proceed or even materials required at the start or during the steps. Both the text and the web provide...
Programming Language C++ Encrypt a text file using Caesar Cipher. Perform the following operations: Read the...
Programming Language C++ Encrypt a text file using Caesar Cipher. Perform the following operations: Read the console input and create a file. ['$' character denotes end of content in file.] Close the file after creation. Now encrypt the text file using Caesar Cipher (Use key value as 5). Display the contents of the updated file. #include <iostream> using namespace std; int main() { // write code here }
Binary file IO Suppose a file has been encrypted using the Caesar cipher as described above,...
Binary file IO Suppose a file has been encrypted using the Caesar cipher as described above, and you know the secret key. Write a program to decrypt (or decode) the file. Your program will prompt the user to enter an input file name for the encrypted file, an output file name for the unencrypted version of the input file, and the secret key. Create a DataInputStream for the input file and a DataOutputStreams for the output file. Next, read the...
Write an essay (2 pages + 1 reference page = 3 pages total) on your assigned...
Write an essay (2 pages + 1 reference page = 3 pages total) on your assigned patient Must have 2 or more references . Your patient is a 45year old female with a medical diagnosis of Hypertension. She has a MD order for Blood Pressure checks every 4 hours (q4h).      A. Name and describe 2 sites and 2 ways (types) to measure her Blood Pressure. (20pts)      B. What are some of the factors that affect Blood Pressure?                       (25...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT