Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please answer it with python code. Assignment Overview (learning objectives) This assignment will give you more experience on the use of 1. integers (int) 2.

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

please answer it with python code.

Assignment Overview (learning objectives) This assignment will give you more experience on the use of 1. integers (int) 2. conditionals 3. iteration 4. strng 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 - her 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)-(AxtN) 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 sometimes 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 len0) 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 4. Apply the formula to get the index of the cipher character: E(x)-(AxtN) mod M 5. Using the index get the cipher character from the alphabet Assignment Overview (learning objectives) This assignment will give you more experience on the use of 1. integers (int) 2. conditionals 3. iteration 4. strng 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 - her 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)-(AxtN) 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 sometimes 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 len0) 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 4. Apply the formula to get the index of the cipher character: E(x)-(AxtN) mod M 5. Using the index get the cipher character from the alphabet

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

How can we think across boundaries from the local to the global?

Answered: 1 week ago

Question

2. What efforts are countries making to reverse the brain drain?

Answered: 1 week ago