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

  • $\begingroup$ Do you know the block size? $\endgroup$ – Randall Aug 24 '18 at 3:42
  • $\begingroup$ There are several examples on this site and the cryptography stack exchange of KP-attacks on Hill ciphers. Look them up. $\endgroup$ – Henno Brandsma Aug 24 '18 at 4:14
  • $\begingroup$ E.g. math.stackexchange.com/q/982030/4280 is one example. $\endgroup$ – Henno Brandsma Aug 24 '18 at 4:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.