Practical Cryptology - Hill Cipher Cryptanalysis Programming Lab


Option 1 (100 points) Write a program that reads two strings - ciphertext and the partial plaintext and finds the key matrix and the complete plaintext using the known plaintext cryptanalysis technique that we learned in class and the decryption part of your Part 1 program.

You can assume that the ciphertext was obtained by encrypting plaintext using Hill Cipher with 2X2 matrix.

You can assume that the ciphertext is a string of UPPER CASE letters and the plaintext is the string of LOWER CASE letters.

You can assume that there are no other characters in the input strings.

Simplification: you can assume that the maximal length of the known plaintext is 10 character. This simplification will result in 5 points reduction.

Your program must print the following:

  • Matrix B for each two pairs that you are trying at the current moment and the determinant of B.
  • The message that tells if you continue to the next pair (since the determinant was not relatively prime with 26) or this pair is good for the following step
  • The final printout should include:
    • the matrix B that gave you a successful determinant (relatively prime with 26),
    • the determinant of B,
    • the inverse of B
    • the final key matrix A.
    • The final plaintext(use Part 1 decryption)
All these intermediate prints and final output will help you to test your program.
Also, pay attention, it could be the situation that the plaintext input is not sufficient to find the key matrix (for example, if the plaintext is MONDAY and ciphertext is SELUKE).
Your program must print the appropriate message in this case. You can test your program for this case on MONDAY and SELUKE as plaintext and ciphertext.

Due Day: Frfiday, October 27

Reduced Complexity Option (75 points): Solve these questions by hand. Explain your answer in detail