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 supply molehill is made up of multiple primal supply molehills. Coercion copy, there jurisdiction be five divergent primal supply molehills authenticationd; the point undivided authenticationd changes with the aspect of each type of the plaintext. .Coercion copy: Assume we entertain a solutionword: apple - This solutionword earn repeat: appleappleapple.... - The condemnation of each communication in the solutionword is the offset n (from your adjudication in Labl, notwithstanding here you demand to authentication the ASCII board). Our plaintext is: ENGINEER - Our molehilltext earn be: &753&53 if you authentication ord and chr with modulus 128 (the unimpaired ASCII board) -This is the encoding or encrypting portio Now coercion the decrypting -Assume you comprehend the solutionword: apple - Given a molehilltext NT Z. APFZcMSEGQlOUcPFZT using ord and chr with modulus 128 - What is the plaintext? In this lab, your operation is to caconservation the encryption and decryption business coercion the supply molehill. Please apportion the authenticationr to input any solution. In the aloft copy, it was APPLE, notwithstanding it could be any solutionword: WHITE, AVERYLONGWORDMANYTIMESOVER

    A polyalphabetic supply molehill is made up of multiple primal supply molehills. Coercion copy, there jurisdiction be five divergent primal supply molehills authenticationd: the point undivided authenticationd changes with the aspect of each type of the plaintext. Coercion copy: Assume we entertain a solutionword: apple This solutionword earn repeat: appleappleapple…. The condemnation of each communication in the solutionword is the offset “n” (from your adjudication in Lab1, notwithstanding here you demand to authentication the ASCII board). Our plaintext is: ENGINEER Our molehilltext earn be: & > 753&53 if you authentication ord and chr with modulus 128 (the unimpaired ASCII board) This is the encoding or encrypting portio Now coercion the decrypting Assume you comprehend the solutionword: apple Given a molehilltext NT_Z._^PFZcMSEGQIOUcPFZT using ord and chr with modulus 128 What is the plaintext? In this lab, your operation is to caconservation the encryption and decryption business coercion the supply molehill. Please apportion the authenticationr to input any solution. In the aloft copy, it was APPLE, notwithstanding it could be any solutionword: WHITE, AVERYLONGWORDMANYTIMESOVER absence of wonder..

    Expert Counterpart

     

    Copyable Adjudication:

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

    preferable = [‘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 code : ‘))

    missive = input(‘Enter missive : ‘)

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

    if choise == 2:

    solution = -key

    coercion char in missive:

    if char.islower():

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

    if char.isupper():

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

     

    translate += char

    print translate