CIT4057 Introduction to Computer Programming

Hello, if you have any need, please feel free to consult us, this is my wechat: wx91due

03CIT4057 Introduction to Computer Programming

Cracking Caesar Cipher

Overview:

The project will be 30% of overall grade of the course.

The project is done by team. Each team is formed by 3‑5 students.

Background:

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 Caesar cipher is named after Julius Caesar, who, according to Suetonius, used it with a shift of three (A be‑ coming D when encrypting, and D becoming A when decrypting) to protect messages of military significance.

While Caesar’s was the first recorded use of this scheme, other substitution ciphers are known to have been used earlier.

Specification:
  • Decrypt a Caesar cipher encrypted text.
  • The encrypted text is stored in a file.
  • The program reads the file and shows the text after decryption.
Bonus:
  • Establish a web server which accepts the encrypted message and then present the decrypted text.
Double bonus:
  • In additional of the manual input, the webserver accepts encrytped text and returns the decrypted text in JSON format.
Deliverables:

Group work:

For every item below, 1 group submits 1 copy only.

1. The group should submit the source code to the GitHub group repository.

2. Powerpoint for the presentation. The PPT SHOULD include the member list. The group should submit the PPT to the Blackboard.

Individual work:

For every item below, every student should submit 1 copy.

3. Student must do a peer review for every member in the group. He/she should fill the 360 review form and submit it to the Blackboard.

Due date

All items mentioned in the Section Deliverables should be submitted on or before 2024‑12‑18 23:59:59.

Presentation:

Each team will present their project in the last class.

Appendix A:

Breaking The Cipher:

To look for the “shift”, you need to know the following technique about cracking Caesar ciphers that has been around for over a thousand years.

Any language such as English has a known distribution for each letter.

For example, the letter “E” is the most common letter in English making up about 12% of the letters on average (ignoring case). The letter “T” is next (about 9%), followed by “A” ( about 8%), and so on. But the point is that only the order “E”, “T” and “A” does matter, not the percentage.

The procedure begins by finding the most common letter. You can guess that the most common letter maps to “E.” You can now find the “shift” from the most common letter in the cipher‑text to the expected most common letter “E”.

For example, if the most common letter in the cipher‑text is “H”, you know that the shift from “E” to “H” is 3. You should check that the shift for the next most common letter “T”, and third most common letter “A” is also

3. Once you know the shift, you can apply the shift to all the letters in the cipher‑text and get the original plain‑text message.

What about spaces between words and punctuation?

In the real world, there is no space or punctuation in a cipher‑text. The reason is that those are useful clues for deciphering.

However, there are spaces in the cipher‑text for this project because they will be helpful for you to recognize that your deciphering is correct or not. But you will need to ignore spaces when counting letters (if you forget to ignore them, beware that the space will be the most common character).

The suggested algorithm will be:

1. Read the cipher‑text.
2. Get a count of each character in the entire cipher‑text (ignore spaces).
3. Find the most common character.
4. Find the shift from “E” to that most common character.
5. Check that the shift also works for the next most common.
6. Using the shift, decode each character of the cipher‑text and print.

发表评论

电子邮件地址不会被公开。 必填项已用*标注