Answered step by step
Verified Expert Solution
Question
1 Approved Answer
CSE 231 Spring 2018 Programming Project 04 Edit on 2/3/18: clarified in the description of main0 that the first prompt is for the rotation, N
CSE 231 Spring 2018 Programming Project 04 Edit on 2/3/18: clarified in the description of main0 that the first prompt is for the rotation, N This assignment is worth 40 points (4.0% of the course grade) and must be completed and turned in before 11:59 PM on Monday, February 12, 2018 Assignment Overview (learning objectives) This assignment will give you more experience on the use of: 1. integers (int) 2. conditionals 3. iteration 4. string The goal of this project is to implement a different cryptographic technique by combining two cryptographic techniques. I call it dumbcrypt. Dumbcrypt is a combination of Affine Cipher and Caesar Cipher. The user will enter a sentence, a string composed of letters, numbers, and punctuation. Notice that spaces are not allowed in the input string because spaces provide too many clues to someone trying to crack your coded message. Your job is to encrypt the sentence using a combination of Affine and Caesar Cipher. The letters and numbers will be encrypted and decrypted using Affine Cipher; the punctuation using Caesar Cipher Assignment Background Affine Cipher - https://en.wikipedia.org/wiki/Affine cipher Affine Cipher is a bit different than Caesar Cipher in that the Affine Cipher uses an encryption function to calculate the integer that corresponds to the cipher text letter. The encryption function for a letter variable named x is E(x)-(Ax+N) mod M Where A and N are keys of the cipher and M is size of the alphabet (for example, M-26 for English letters; M- 36 for English letters plus digits). The decryption of Affine Cipher only works when A and M are co-primes of each other N will be an input to the program and will be fixed for the whole run of the program. N is sometime:s referred to as the "rotation" but is effectively a key Co-primes are a pair of numbers whose greatest common divisor (GCD) is 1. Only one co-prime is needed (of possibly many). For this project we choose the smallest greater than one so everyone is using the same one making testing feasible. Algorithm 1. Calculate M, the number of characters in the alphabet (Hint: use len(0) 2. Calculate A using get smallest co prime (M) 3. For the character to be encrypted find its index in the alphabet: x in the formula is the index
Step 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