I am giving a presentation in my college where hill cipher is a part of the presentation. I just wanted to know, how is the hill cipher key matrix is exchanged securely in order to decrypt the message?

  • 1
    $\begingroup$ You should be aware that the Hill cipher is unsafe for messages sizably larger than the key. $\endgroup$
    – fgrieu
    Commented Aug 17, 2018 at 6:04
  • $\begingroup$ @fgrieu how so? $\endgroup$ Commented Aug 17, 2018 at 6:25
  • 1
    $\begingroup$ A guess of the plaintext the size of the key allows to find the key by solving a linear system of equations. That guess can be verified by deciphering later ciphertext and checking if it makes sense. That allows to break the Hill cipher much faster than trying all keys. Also, the usual 3x3 variant only has $2^{44.3\ldots}$ keys, making it vulnerable to brute force key search. $\endgroup$
    – fgrieu
    Commented Aug 17, 2018 at 8:18

1 Answer 1


In the Hill cipher, like in any symmetric cipher, it is assumed that both parties have the same secret key already.

Securely exchanging a key is not part of the symmetric algorithm, neither is it its job. That a separate protocol that needs to be done beforehand.

  • $\begingroup$ What is that protocol? If i am sending a message to person x using hill cipher how would I make sure that he has the same key? $\endgroup$ Commented Aug 16, 2018 at 18:05
  • $\begingroup$ @SrijanSingh Use a standard key exchange protocol, using RSA, Diffie-Hellman or one of many other methods. You should also specify an encoding for a Hill-cipher key. The Hill-cipher does not specify it, nor does it have a key-exchange algorithm "built-in". $\endgroup$ Commented Aug 16, 2018 at 18:07
  • $\begingroup$ Okay, understood. Btw, how would you share the specified encoding? $\endgroup$ Commented Aug 16, 2018 at 18:21
  • $\begingroup$ @SrijanSingh that depends on how you define the Hill cipher. It's not a standard. Do you use only lowercase letters, or bytes etc. etc. Use your imagination. $\endgroup$ Commented Aug 16, 2018 at 18:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.