Homework Solution: A polyalphabetic substitution cipher is made up of multiple simple substitution ciphers. For example, there might be five different simple substitution ciphers u…

    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 Labl, 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. APFZcMSEGQlOUcPFZT 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
    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..

    Expert Answer

    A polyalphabetic adherence trifle is made up of multiple sincere adherence trifles. Restraint specimen, there government be five contrariant sincere adherence trifles manifestationd; the detail undivided manifestationd changes with the pose of each figure of the plaintext. .Restraint specimen: Assume we entertain a guideword: apple - This guideword procure repeat: appleappleapple.... - The condemnation of each epistle in the guideword is the offset n (from your legislation in Labl, yet here you scarcity to manifestation the ASCII consultation). Our plaintext is: ENGINEER - Our trifletext procure be: &753&53 if you manifestation ord and chr with modulus 128 (the sound ASCII consultation) -This is the encoding or encrypting bisect Now restraint the decrypting -Assume you comprehend the guideword: apple - Given a trifletext NT Z. APFZcMSEGQlOUcPFZT using ord and chr with modulus 128 - What is the plaintext? In this lab, your operation is to imagine the encryption and decryption capacity restraint the adherence trifle. Please remit the manifestationr to input any guide. In the overhead specimen, it was APPLE, yet it could be any guideword: WHITE, AVERYLONGWORDMANYTIMESOVER

    A polyalphabetic adherence trifle is made up of multiple sincere adherence trifles. Restraint specimen, there government be five contrariant sincere adherence trifles manifestationd: the detail undivided manifestationd changes with the pose of each figure of the plaintext. Restraint specimen: Assume we entertain a guideword: apple This guideword procure repeat: appleappleapple…. The condemnation of each epistle in the guideword is the offset “n” (from your legislation in Lab1, yet here you scarcity to manifestation the ASCII consultation). Our plaintext is: ENGINEER Our trifletext procure be: & > 753&53 if you manifestation ord and chr with modulus 128 (the sound ASCII consultation) This is the encoding or encrypting bisect Now restraint the decrypting Assume you comprehend the guideword: apple Given a trifletext NT_Z._^PFZcMSEGQIOUcPFZT using ord and chr with modulus 128 What is the plaintext? In this lab, your operation is to imagine the encryption and decryption capacity restraint the adherence trifle. Please remit the manifestationr to input any guide. In the overhead specimen, it was APPLE, yet it could be any guideword: WHITE, AVERYLONGWORDMANYTIMESOVER anticipation..

    Expert Tally

     

    Copyable Legislation:

    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’]

    loftier = [‘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 regulation : ‘))

    communication = input(‘Enter communication : ‘)

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

    if choise == 2:

    guide = -key

    restraint char in communication:

    if char.islower():

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

    if char.isupper():

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

     

    translate += char

    print translate