ENGG 1003 English Text Ciphers Programming Assignment
Need Help Writing an Essay?
Tell us about your assignment and we will find the best writer for your paper.
Write My Essay For MeIntroduction
A cipher is an algorithm which encrypts a message into cipher text so that it can be safely transmitted without an eavesdropper being able to (easily) read it. For the purposes of this assignment the message and ciphertext will be stored as strings of ASCII characters.
Cipher algorithms always perform two tasks: encryption and decryption. The encryption process takes a “message” and “key” as inputs and produces cipher text. The decryption process performs the reverse: it turns cipher text and the key back into the original message.
The exact details of how the key and message are processed to produce the cipher text vary between algorithms. However, the general principle is that algorithms employ a mathematical function which is “easy” to calculate with the key but “difficult” to invert without it. A rigorous discussion of modern cryptographic techniques can be found in the excellent (but highly mathematical) text, An Introduction to Mathematical Cryptography (available in the Auchmuty library). ENGG 1003 English Text Ciphers Programming Assignment
This assignment will cover three cipher algorithms:
- The classical “rail-fence” cipher
- A modified “2-level” rail-fence cipher
- The substitution cipher
Your task is to write a C program which performs the following broad tasks:
- Encryption of a message using the classical rail-fence cipher algorithm
- Encryption of a message using the 2-level rail-fence cipher
- Decryption of a message using the 2-level rail-fence cipher
- (HD level) Partial decryption of a block of cipher text encrypted with a substitution cipher without the key
Level Rail-fence Cipher
This section describes a transposition cipher algorithm which has been created for this project. To my knowledge code for this cipher does not commonly exist on the Internet.
A transposition cipher is one which creates ciphertext by re-ordering the characters in the message. This is similar to an anagram except the output cipher text looks like random characters, not a new word.
The algorithm documented here is an extension of the classical rail-fence cipher. You should read about it here and here before continuing. You can view C code for this cipher here. Your implementation should be done from scratch and not simply re-use existing code.
The encryption algorithm involves two broad steps:
- Writing the message on a 2D grid where each row is called a “rail”. The message “zig-zag“s between the top and bottom rails, one message character per column. The height (number of rows) is the “key”.
- The cipher text is created by reading the characters off the grid in a top-to-bottom-left-to-right
sequence.
Where the classical rail fence cipher has a “key” which is a single integer, A, your algorithm will use two integers A, and B with A>B and B > 1; alternating between them when writing out the message on the fence rails. This algorithm reduces down to the classical rail fence cipher if A = B. ENGG 1003 English Text Ciphers Programming Assignment
2.1.1 General Example
If the message characters are denoted A, B, C, D, … , etc and the cipher key is chosen as A = 4 and B = 2 then the message characters would be written on the rails as:
A——-I——-Q -B—–H-J—–P- –C-E-G—K-M-O– —D-F—–L-N—
Observe the general pattern in the algorithm:
- Down A rails (to D)
- Up to a peak of B rails (up 1 to E)
- Down B − 1 rails back to the bottom (down 1 to F)
- Up to a peak of A rails (up 3 to I)
- Repeat until whole message has been written to the grid
The ciphertext can then be read off left-to-right-top-to-bottom:
A, I, Q, B, H, J, P, C, E, G, K, M, O, D, F, L, N
Optional For the purposes of this assignment your message may be “padded” with random characters so that it completes a full cycle on the rails. ie: It always finishes on the top rail. Note that ASCII lower case letters take the values 97 to 122 so a random lower case letter can be generated with rand()%26+97. Similarly, a random upper case letter is generated with rand()%26+65. Note that a N cycles require N × (2A + 2B − 4) + 1 letters. ENGG 1003 English Text Ciphers Programming Assignment
The post ENGG 1003 English Text Ciphers Programming Assignment appeared first on EssayPanthers.
- Confidentiality & Authenticity Guaranteed
- Plagiarism Free answers Guarantee
- We Guarantee Timely Delivery of All essays
- Quality & Reliability
- Papers Written from Scratch and to Your exact Instructions
- Qualified Writers Only
- We offer Direct Contact With Your Writer
- 24/7 Customer Support