Hill cipher , known plaintext attack.

180 Views Asked by At

I know the plaintext and ciphertext. I want to find the vector key which is used to encrypt the text. here is the step I want to do.

  1. The convert the ciphertext and plaintext into matrix of n x n.
  2. Find the inverse of the matrix which is equal to MM-1..
  3. Use the function $k=p-c \pmod{26}$ to get the keys. This function delivered from $C=P\cdot K \pmod {26}$.

anything else, I missed or wrong? I cannot implement it in the code, not sure what wrong