Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Problem 7. We use affine ciphers modulo 26 to allow us to encode all 26 letters in the English alphabet, and we ignore all other

image text in transcribed
Problem 7. We use affine ciphers modulo 26 to allow us to encode all 26 letters in the English alphabet, and we ignore all other symbols to stay within these 26 characters. If we want to encrypt and decrypt faithfully all US English texts, including numbers, spaces, punctuation, and proper capitalization, we will need to allow the encryption and decryption functions to handle all printable ASCII characters - these have ASCII codes from 32 to 126 . If we use the codes 0,1,,94 for the ASCII characters with codes 32,33,,126, this will require us to use affine cipher modulo 95 : the key will be a pair (a,b) such that 0a,b94, with gcd(a^,95)=1. (a) Write encryption and decryption functions, Enc (x) and Dec (x), that implement such an affine cipher modulo 95 with the key (47,64). Your functions should: (i) take as inputs strings; (ii) convert the input string to a list of ASCII codes, adjusted appropriately; (iii) process that list modulo 95; (iv) convert the answer back to a string and return that string as output. [To convert strings to ASCII and back, you will need to use the tools built into your programming language of choice. For the decryption function, you may want to use the function ModInv (a,n) from Problem 6 with n=95.] (b) Write encryption and decryption functions, Enc (x, key ) and Dec (x, key), that generalize the functions you wrote in part (a) to a generic key (a,b), passed as an input. (c) How many different affine ciphers of this kind are there

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

Microsoft SQL Server 2012 Unleashed

Authors: Ray Rankins, Paul Bertucci

1st Edition

0133408507, 9780133408508

More Books

Students also viewed these Databases questions

Question

=+What the product does for the end-user.)

Answered: 1 week ago