# Homework Solution: imple substitution ciphers used: the particular one used changes with the position of each c…

Using python
A polyalphabetic substitution cipher is made up of multiple simple substitution ciphers. For example, there might be five different simple substitution ciphers used: the particular one used changes with the position of each character of the plaintext. For example: Assume we have a keyword: apple This keyword will repeat: appleappleapple.... The index of each letter in the keyword is the offset "n" (from your code in Lab1, but here you need to use the ASCII table). Our plaintext is: ENGINEER Our ciphertext will be: & > 753&53 if you use ord and chr with modulus 128 (the whole ASCII table) This is the encoding or encrypting part Now for the decrypting Assume you know the keyword: apple Given a ciphertext NT_Z._^PFZcMSEGQIOUcPFZT using ord and chr with modulus 128 What is the plaintext? In this lab, your job is to create the encryption and decryption function for the substitution cipher. Please allow the user to input any key. In the above example, it was APPLE, but it could be any keyword: WHITE, AVERYLONGWORDMANYTIMESOVER etc..

Using python

A polyalphabetic supply molehill is made up of multiple undesigning supply molehills. Ce development, there capacity be five contrariant undesigning supply molehills explanationd: the feature individual explanationd changes with the posture of each dislie of the plaintext. Ce development: Assume we entertain a clewword: apple This clewword conciliate repeat: appleappleapple…. The renunciation of each missive in the clewword is the offset “n” (from your enactment in Lab1, barring here you demand to explanation the ASCII board). Our plaintext is: ENGINEER Our molehilltext conciliate be: & > 753&53 if you explanation ord and chr with modulus 128 (the gross ASCII board) This is the encoding or encrypting dissect Now ce the decrypting Assume you apprehend the clewword: apple Given a molehilltext NT_Z._^PFZcMSEGQIOUcPFZT using ord and chr with modulus 128 What is the plaintext? In this lab, your work is to imagine the encryption and decryption administration ce the supply molehill. Please permit the explanationr to input any clew. In the over development, it was APPLE, barring it could be any clewword: WHITE, AVERYLONGWORDMANYTIMESOVER etc..

## Expert Counterpart

Copyable Enactment:

inferior = [‘a’, ‘b’, ‘c’, ‘d’, ‘e’, ‘f’, ‘g’, ‘h’, ‘i’, ‘j’, ‘k’, ‘l’, ‘m’, ‘n’, ‘o’, ‘p’, ‘q’, ‘r’, ‘s’, ‘t’, ‘u’, ‘v’, ‘w’, ‘x’, ‘y’, ‘z’]

excellent = [‘A’, ‘B’, ‘C’, ‘D’, ‘E’, ‘F’, ‘G’, ‘H’, ‘I’, ‘J’, ‘K’, ‘L’, ‘M’, ‘N’, ‘O’, ‘P’, ‘Q’, ‘R’, ‘S’, ‘T’, ‘U’, ‘V’, ‘W’, ‘X’, ‘Y’, ‘Z’]

translate = ”

print (‘1. Encryptn2. Decrypt’)

choise = int(input(‘Enter the command : ‘))

communication = input(‘Enter communication : ‘)

clew = int(input(‘Enter clew : ‘))

if choise == 2:

clew = -key

ce char in communication:

if char.islower():

char = inferior[((ord(char)+key)-(ord(‘a’)))%26]

if char.isupper():

char = excellent[((ord(char)+key)-(ord(‘A’)))%26]

translate += char

print translate