Language and Codes Midterm:


Due Thursday November 5: 11:00 A.M.

Multiplication tables mod 26

Word pattern Files

English statistical info

    Ciphers

    Encryption  

    Encode the following message using a shift 8 cipher, Note: You may use the encryption tool described here or you may do this by hand.

      A large knapsack carries much.
    Note: The encryption GUI tool you downloaded does not encrypt upper case letters, so you need to convert everything to lower case before encrypting with it.

    Now encode it using a shift 9 cipher.

    Decryption  

    The following messages have been encoding using a shift cipher with key 8. Decode.

    1. emtkwum bw bpm eiksg ewztl wn kzgxbwozixpg
    2. tivociom qa zmlcvlivb
    Cryptography  

    The following message has been encoded using a shift cipher. What is the key?

      nylby zcypq fytc zge cypq
    Affine
    encryption
     

    Encrypt the following message using an affine cipher in which the slope is 9 and the shift is 5 (encryption key = (9,5)):

      attack at dawn
    Affine decryption  

    Decrypt the following message assuming it is an affine cipher with a slope of 7 and a shift of 3:

      dmmhqf rheafsz dsf qxg zfrnsf
    Finding
    Affine
    Keys
     

    Determine the shift and slope for the following affine encryption scheme:

      Plain Text 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
      Cipher Text j k l m n o p q r s t u v w x y z a b c d e f g h i
    Valid
    Affine Keys
     

    Consider affine ciphers whose shift component is 0, that is affine ciphers whose key is of the form (m,0), where m is any valid slope.

    State the correct constraint for valid keys.

    What letter receives the same encoding for all valid affine cipher keys of the form (m,0)? Why?

    Vigenere
    Cipher
     

    Consider the following Vigenere key:

      kyrckoff
    Vigenere encrypt the following
      Harrys bar is a good restaurant
    Hill
    Cipher
    I
     

    Consider the following matrix:

    |8   3|
    |1   5|
    
    Is this a valid Hill cipher key? Show your work.
    Hill
    Cipher
    II
     

    The following is a valid Hill cipher key:

    |8   1|
    |1   9|
    
    Encrypt the characters 'th' using this key.

    Give the inverse of this key. Show your work. Check your work by decrypting the encryption of 'th'.

    Decryption  

    Decrypt the following message encrypted with an arbitrary substitution cipher:

      ceoyn sxbks yx eoiiak yx woph yeoy qvanybxk con fabks onwag bk yea cebya exvna okg yepxvsexvy conebksyxk yxgor on yea ipanbgakyn yxi ixhbybzoh ogmbnap oiiaopag uxp o uxvpye ybda fauxpa yea spokg tvpr bk yea zbo haow ipxfa yeoy ea okncapag qvanybxkn uxp uxvp okg o eohu exvpn xkhr bkzpaonag niazvhoybxk yeoy pxma dbsey fa yea yopsay xu ok bkgbzydaky ceak niazboh zxvknah ioypbzw ubyjsapohg cpoin vi ebn cxpw hoyap yebn dxkye

    Some relevant stats:

    
    letter_frequencies = [
    ('a', 37), ('y', 37), ('o', 33), ('x', 26), ('b', 24), ('e', 24), ('k', 23), 
    ('p', 23), ('n', 21), ('i', 13), ('g', 12), ('v', 12), ('h', 11), ('s', 9), 
    ('c', 8), ('u', 8), ('z', 8), ('w', 5), ('d', 4), ('f', 4), ('r', 3), ('m', 2), 
    ('q', 2), ('j', 1), ('t', 1)]
    
    top_digraph_frequencies = [
    ('ye', 12), ('ea', 7), ('bk', 7), ('oy', 7), ('xv', 7), ('eo', 6), 
    ('xk', 6), ('yb', 5), ('yx', 5), ('on', 5), ('ok', 5), ('pa', 5), 
    ('ux', 5), ('eb', 4), ('oh', 4), ('xp', 4), ('vp', 4), ('ag', 4), 
    ('ak', 4), ('ap', 4), ('ia', 4), ('na', 4), ('fa', 4), ('kg', 4), 
    ('ex', 3), ('bn', 3), ('bx', 3), ('by', 3), ('bz', 3), ('oi', 3), 
    ('op', 3), ('ce', 3), ('px', 3), ('po', 3), ('ao', 3), ('an', 3), 
    ('kn', 3), ('ks', 3), ('ky', 3), ('yn', 2), ('ya', 2), ('da', 2), 
    ('qv', 2), ('zb', 2), ('bo', 2), ('co', 2), ('va', 2), ('ip', 2), 
    ('ii', 2), ('az', 2), ('ni', 2), ('ny', 2), ('sa', 2), ('se', 2), ('ho', 2)]
    
    One Letter Words = ['o', 'o']
    
    Two Letter Words = ['yx', 'yx', 'bk', 'on', 'bk', 'ea', 'fa', 'xu', 'ok', 'vi']
    
    Three Letter Words = ['con', 'yea', 'okg', 'yea', 'yxi', 'uxp', 'yea', 'yea', 
                          'zbo', 'uxp', 'okg', 'yea', 'ebn']
    
    Linear Y  

    A list of words in linear Y:

    11 01 00 01
    11 01 12 21
    11 01 21 20
    12 11 01 21
    12 11 10 20
    12 11 22 01
    21 21 00 01
    21 21 12 21
    21 21 21 20
    
    3 consonants, 3 vowels again.

    Here is the pronunication of 1 word:

    takopeto = 11 01 21 20
    
    Decode.