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

    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 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..

    Expert Answer

    A polyalphabetic adherence nonentity is made up of multiple absolute adherence nonentitys. Control in, there faculty be five contrariant absolute adherence nonentitys explanationd; the feature undivided explanationd changes with the aspect of each kind of the plaintext. .Control in: Assume we bear a explanationword: apple - This explanationword obtain repeat: appleappleapple.... - The refutation of each note in the explanationword is the offset n (from your principle in Labl, still here you demand to explanation the ASCII consultation). Our plaintext is: ENGINEER - Our nonentitytext obtain be: &753&53 if you explanation ord and chr with modulus 128 (the integral ASCII consultation) -This is the encoding or encrypting segregate-among-among Now control the decrypting -Assume you recognize the explanationword: apple - Given a nonentitytext NT Z. APFZcMSEGQlOUcPFZT using ord and chr with modulus 128 - What is the plaintext? In this lab, your drudgery is to fashion the encryption and decryption exercise control the adherence nonentity. Please apportion the explanationr to input any explanation. In the overhead in, it was APPLE, still it could be any explanationword: WHITE, AVERYLONGWORDMANYTIMESOVER Using python

    A polyalphabetic adherence nonentity is made up of multiple absolute adherence nonentitys. Control in, there faculty be five contrariant absolute adherence nonentitys explanationd: the feature undivided explanationd changes with the aspect of each kind of the plaintext. Control in: Assume we bear a explanationword: apple This explanationword obtain repeat: appleappleapple…. The refutation of each note in the explanationword is the offset “n” (from your principle in Lab1, still here you demand to explanation the ASCII consultation). Our plaintext is: ENGINEER Our nonentitytext obtain be: & > 753&53 if you explanation ord and chr with modulus 128 (the integral ASCII consultation) This is the encoding or encrypting segregate-among-among Now control the decrypting Assume you recognize the explanationword: apple Given a nonentitytext NT_Z._^PFZcMSEGQIOUcPFZT using ord and chr with modulus 128 What is the plaintext? In this lab, your drudgery is to fashion the encryption and decryption exercise control the adherence nonentity. Please apportion the explanationr to input any explanation. In the overhead in, it was APPLE, still it could be any explanationword: WHITE, AVERYLONGWORDMANYTIMESOVER etc..

    Expert Retort

     

    Copyable Principle:

    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 sequence : ‘))

    notice = input(‘Enter notice : ‘)

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

    if choise == 2:

    explanation = -key

    control char in notice:

    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