Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

do the following in python idle 3.5 or higher know nothing on this subject Eile

ID: 3808661 • Letter: D

Question

do the following in python idle 3.5 or higher know nothing on this subject

Eile Edit Yew Hbtory Bookmarks bols Help Microsoft Word-Situatio x S Female coaches: Why are. x a SakaieURI:csc 110 spri.. x O lab7-crypto-s17-labr-cry. x Writer The owing Code. x https sakai. 7-Cryptog rithms -10 28 /lab7-cryp 67k e a Search A Most visited e Getting started To decode an Affine cipher, we need to reverse the process. This is not a simple as reversing a Caesar cipher because it involves multiplication and addition. We need to find a way to reverse the operations in the encryption algorithm. Since we are doing modular multiplication, we need to find the modular inverse of the multiplier a. n other words, we need to find a number x such that: ex mod 26 1 once you have determinedx,the modular inverse of a, the decryption formula is pax (c-b mod m where c is the numerical value ofthe ciphertext letter and pis the numerical value of the plaintext. The algorithm to decrypt a ciphertext message given the keys a and b is Find the modular inverse ofa mod m. For each letter in the ciphertext o Convert the letter to the corresponding number c(see table above). o Compute the plaintext number using the formula p x (c-b mod m o Find the plaintext letter in the alphabet that corresponds to the number p o Append the plaintext letter to the plaintext you are generating a Practice decrypting a message that was encrypted with the Affine cipher Given the following ciphertext messages that wereencrypted using the Affine cipher with a 11 and b 6. (m is 26 since we have an alphabet of 26 letters First find the modular inverse of a 11 mod 26. Remember, this means you want a number X such that a mod 26-1

Explanation / Answer

def decrypt(ciphertext, a, b):
decrypted_text = ''
for letter in ciphertext:
m = 26 # this was given
c = ord(letter) - 96 # I am just guessing here since you haven't provided the table (see table above?? in the algorithm written)
x = findx(a)
p = (x * (c - b)) % m
plaintext_letter = chr(p)
decrypted_text = decrypted_text + plaintext_letter
return plaintext_letter

def findx(a):
x = 1
while True:
if (a * x) % 26 == 1:
return x
x += 1

print decrypt("some ciphertext given in question which you havent shown", 11, 6) # given the following ciphertext messages?