Question: Answer in Python according to instructions Problem 3: Complete the implementation of the function decryptRSA(G, P, q, ) which depends on modinv(a,m) and the given
Problem 3: Complete the implementation of the function decryptRSA(G, P, q, ) which depends on modinv(a,m) and the given functions RSAdigits2letters(d) and blocksize(n). When you are done, you can test your function against the given samples. In [J: def decryptRSA(c, p, q, e): "decrypts the cipher c, which was encrypted using the key (p a, e) INPUT: C ciphertext as a string of digits p, q - prime numbers used as part of the key n e integer satisfying ged((p-1) (q-1), e) 1 -p q to encrypt the ciphertext OUTPUT: The decrypted message as a string of letters c_copy c.replace("taking out all spacing e inv modinv(e, m) FIXME: Enter the appropriate modulo for calculating inverse of e FIXME: Enter the appropriate modulo for calculating decryption of each digits "- k blocksize(n) #size of each block is calculated by function blocksize() start e for i in range(e,len(c_copy), k): block = c-copy[start: start + k] #creating a block of digits digit str(FIXME GOES HERE) # FIxXNE: Enter the appropriate calculation for the decryption of each bloc if en(digit) %2 lei: it#padding the block before adding it to the string digits + digit else digits digit start +: k #updating starting index for next block return RSAdigitsnet ters(digits) #convert ing digits to letters
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
