Question: Write a script in octave to decrypt a given word / phrase using Affine Cipher . It is an example of a Monoalphabetic substitution cipher.

Write a script in octave to decrypt a given word/phrase using Affine Cipher . It is an example of a Monoalphabetic substitution cipher. The decryption process is done by using the following formula:
P= a_inv (C- b) mod 26.
where a,b are two integers representing the key (selected randomly, gcd(a,26) must be 1.
a_inv * a mod 2611
C is the ciphertext value, and P is the plaintext value.
C and P integers with values between 0 and 25.
Use the following variable names:
ciphertext for the ciphered text to be decrypted
a where a and 26 are coprime
b any number between 1 to 25
Your code should display the following:
the plaintext
Requirements:
Max 30 code statements
Hints & tips:
CodeRunner will test your script using different values of a,b, and ciphertext
Your output may include the variable name you have used (CodeRunner will just ignore it).
An example showing the expected output (CodeRunner formatting) for the values specified is given below.
For example:
TestResult
ciphertext= 'UZIZWUZWSU'; a =5; b =8 ;
Plaintext: STATISTICS
ciphertext= 'OHNQRYUJOQH JEMFHQPQWC'; a =9 ; b =20 ;
Plaintext: INFORMATION TECHNOLOGY
ciphertext= 'YEAGELRW'; a =23 ; b =16 ;
Plaintext: GEOMETRY
ciphertext='NQVRQSD'; a =2 ; b =16 ;
No modular inverse 2. Decryption not possible.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!