Answered step by step
Verified Expert Solution
Question
1 Approved Answer
PLEASE WRITE IN PYTHON USING JUPYTER NOTEBOOK Create a function affineEncrypt(text, a,b ) that returns the cipher text encrypted using key (a,b). You must verify
PLEASE WRITE IN PYTHON
USING JUPYTER NOTEBOOK
Create a function affineEncrypt(text, a,b ) that returns the cipher text encrypted using key (a,b). You must verify that the gcd(a,26)=1 before making the encryption. If this is not the case, the function must raise a ValueError with message "The given key is invalid. The gcd(a,26) must be 1.". You may NOT use any built-in functions as part of your implementation, but you may use any functions you implemented in previous coding assignments. Please make sure to copy and paste them into this file, so that they are uploaded to CodePost when you submit your pa3.py file. def affineEncrypt (text, a,b) : "" "encrypts the plaintext 'text', using an affine transformation key (a, b) INPUT: text - plaintext as a string of letters a-integersatisfyinggcd(a,26)=1.Raiseserrorifsuchisnotthecasb-integer OUTPUT: The encrypted message as a string of characters "N" pass
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