In cryptography, a caesar cipher is one of the simplest

 

Some encrypted text will be provided and your job is to write a C program to decrypt it. As always, the C program should be submitted as a standard C source code file. Please note that the computer program should comply with the commenting and formatting rules as described in class. For example, there should be a header for the whole program that gives the author’s name, class name, date, and description. End braces should be commented, and there are alignment and indenting requirements as discussed.

Basic Caesar Cipher –

In cryptography, a Caesar Cipher is one of the simplest and most widely known encryption techniques. It is a type of substitution cipher in which each letter in the plaintext is replaced by a letter some fixed number of positions down the alphabet. For example, with a left shift of 3, D would be replaced by A, E would become B, and so on. The method is named after Julius Caesar, who used it in his private correspondence. (https://en.wikipedia.org/wiki/Caesar_cipher).

In a Caesar Cipher, the encryption is performed against a key string, which is often just the 26 letters of the alphabet. An offset value is defined that consists of a positive or negative integer. The plaintext (the normal text) is encrypted, one letter at a time, by using that offset value in the following way: (a) the index position within the key string of the letter to be encrypted is determined, (b) the offset value is applied to that index in order to obtain a new index within the key string, (c) the character at the new index is written as the cipher text.

The basic Caesar Cipher has a characteristic that makes it relatively easy to break: every character in the plain text is encoded with the same character in the cipher text. In the above example, every space is encoded with an ‘E’. Since the space is the most commonly used character, an observant reader could assume that a space is represented by an ‘E’ and determine the offset from that.

A variation on the basic Caesar Cipher uses a variable offset, one that is different for each character encoded. In this algorithm, the first character of the plain text will be encoded by some firstOffset as above, the next character is encoded by (firstOffset+1), the next by (firstOffset+2), etc. As you can see, the offsets grow sequentially from the first character of the plain text to the last. This ensures that instances of a character in the plain text will be represented by different characters in the cipher text.

Here is the above string encoded with a sequential offset that begins with 5. Notice that the “I” is still encoded by “N”, but all of the other characters are different.

Plain text: I LOVE TO FLY

Cipher text: NFSWDOKEANUAO

Here the “I” is encoded with an offset of 5, yielding a cipher text character “N”. The first space is encoded with an offset of 6, yielding a cipher text character of “F”. The “L” is encoded with an offset of 7, yielding a cipher text character of “S”, and so forth. Each character is encoded by an offset 1 larger than the preceding character until the end of the plain text is reached. Let’s apply the modified Caesar Cipher described above to a more complicated example. What follows is the key string you can use to decrypt the cipher text.

Key String: “hXTFexn39AJ6cmCYgktNuUwBdlKL04R1DSQrH y5q8VpjIZMGivEfasoWOb72zP“

The only characters in the key string are lower case alpha characters, upper case alpha characters, digits from 0 to 9, and a space. Those characters have been jumbled up to make the problem more difficult. The double quotes are used to mark the end of the key string; they are not part of it. The cipher text that you need to decrypt against that key string is:

Ciper text: “Vs8dLIcPJuiEfFsyOA89JTIv06iFu5aSw O27L4pzkTAwkyEl”

Of necessity, all of the characters in the cipher text are contained in the key string. The sequential offset values used to encrypt the plain text are positive and can begin with any number between 1 and 60. (You should, therefore, apply negative sequential offsets to decrypt the cipher text.)

Assignment –

Your task is to determine the initial offset value that will correctly decrypt the cipher text above and apply the modified Caesar Cipher algorithm to it to decrypt the string. When you find the correct initial offset, you will be able to read the string. If you do what the decrypted string says, you can have 5 extra bonus points.

In order to determine the initial offset value, your program should calculate all possible initial offsets from 1 to 60. Your output should look like the following, where “Offset” means “Initial Offset”:

Cipher Text: “Vs8dLIcPJuiEfFsyOA89JTIv06iFu5aSw O27L4pzkTAwkyEl”

Offset: 1; Result: 8fyuw5xsXJy55f5wqswEfpwKFGwysAwXfFwdwfaFuyw0qQsF5

Offset: 2; Result: qE NUyeahA yyEyU5aUvEVUlTMU a9UhETUBUEfTN UL5SaTy

Offset: 3; Result: 5vHtu FfP9H v uyfuiv8udXZuHf3uPvXuwuvEXtHuKyDfX

Offset: 4; Result: yirkNHTEz3rHHiHN ENGiqNBhINrEnNzihNUNivhkrNl 1EhH

Offset: 5; Result: GQgtrXv2nQrrGrtHvtMG5twPjtQvxt2GPtutGiPgQtdHRvPr

Offset: 6; Result: ……

Remember that since the cipher text was encrypted with positive offsets, you will decrypt with negative offsets. These are actual data, so you can use these to check your program. After the full list is generated, you will be able to visually scan through it and determine the offset and the plain text.

Hints –

The following functions might be useful to your solution:

1. A function to determine the length of a C-string. Note that the ‘’ is not included in the length calculation.

a. int strlen(char *); (<string.h>)

2. A function to locate a character within a C-string and return its index value.

a. This function can be used to find a given character within the key string.

Finally, you can initialize a C-string with the key string and cipher text specified above by copy/pasting those strings into your code, but here is an important point: never copy/paste from a non-text file, like a PDF for example, directly into your code. Instead, copy/paste the text into Notepad or Notepad++ first, then copy/paste into your code. This eliminates most of the problems caused by hidden formatting characters and other issues.

Duepapers
Calculate your paper price
Pages (550 words)
Approximate price: -

Why Work with Us

Top Quality and Well-Researched Papers

We always make sure that writers follow all your instructions precisely. You can choose your academic level: high school, college/university or professional, and we will assign a writer who has a respective degree.

Professional and Experienced Academic Writers

We have a team of professional writers with experience in academic and business writing. Many are native speakers and able to perform any task for which you need help.

Free Unlimited Revisions

If you think we missed something, send your order for a free revision. You have 10 days to submit the order for review after you have received the final document. You can do this yourself after logging into your personal account or by contacting our support.

Prompt Delivery and 100% Money-Back-Guarantee

All papers are always delivered on time. In case we need more time to master your paper, we may contact you regarding the deadline extension. In case you cannot provide us with more time, a 100% refund is guaranteed.

Original & Confidential

We use several writing tools checks to ensure that all documents you receive are free from plagiarism. Our editors carefully review all quotations in the text. We also promise maximum confidentiality in all of our services.

24/7 Customer Support

Our support agents are available 24 hours a day 7 days a week and committed to providing you with the best customer experience. Get in touch whenever you need any assistance.

Try it now!

Calculate the price of your order

Total price:
$0.00

How it works?

Follow these simple steps to get your paper done

Place your order

Fill in the order form and provide all details of your assignment.

Proceed with the payment

Choose the payment system that suits you most.

Receive the final file

Once your paper is ready, we will email it to you.

Our Services

No need to work on your paper at night. Sleep tight, we will cover your back. We offer all kinds of writing services.

Essays

Essay Writing Service

No matter what kind of academic paper you need and how urgent you need it, you are welcome to choose your academic level and the type of your paper at an affordable price. We take care of all your paper needs and give a 24/7 customer care support system.

Admissions

Admission Essays & Business Writing Help

An admission essay is an essay or other written statement by a candidate, often a potential student enrolling in a college, university, or graduate school. You can be rest assurred that through our service we will write the best admission essay for you.

Reviews

Editing Support

Our academic writers and editors make the necessary changes to your paper so that it is polished. We also format your document by correctly quoting the sources and creating reference lists in the formats APA, Harvard, MLA, Chicago / Turabian.

Reviews

Revision Support

If you think your paper could be improved, you can request a review. In this case, your paper will be checked by the writer or assigned to an editor. You can use this option as many times as you see fit. This is free because we want you to be completely satisfied with the service offered.