Find the message on Hill Cipher

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
0
down vote

favorite













We assume that the message $$!IWGVIEX!ZRADRYD$$ has been encrypted
using Hill Cipher and with the correspondence $A=0,...,Z=25, _=26, ? =27,!=28$. We know that the last five letters of plaintext are sender's signature $MARIA$.



We want to find the deciphering matrix and read the message.




My attempt: At first we suppose that $m=2, P=C=BbbZ_29$ and $K=mathrmGL_2(BbbZ_29)$. By the hypothesis, we know that $MARIA leftrightarrow ADRYD iff (12,0,17,8,0)leftrightarrow (0,3,17,24,17)$.



This implies that, if we assume that the key matrix is $Ain mathrmGL_2(BbbZ_29)$, the diciphering function is
$$ E_A: (BbbZ_29)^2 longrightarrow (BbbZ_29)^2,\
(12,0)mapsto (12,0)cdot A =(0,3), \
(17,8) mapsto (17,8)cdot A=(17,24) $$
so,
$
beginpmatrix
12 & 0 \
17 & 8
endpmatrix cdot A = beginpmatrix
0 & 3 \
17 & 24
endpmatrix $.
We define $B:=beginpmatrix
12 & 0 \
17 & 8
endpmatrix$. Then, $det B=9 in U_29 iff B in mathrmGL(BbbZ_29)$. Also, $mathrmadj B= beginpmatrix
8 & 0 \
12 & 12
endpmatrix $ and $9^-1=13 in U_29$. So,
$$B^-1=13 beginpmatrix
8 & 0 \
12 & 12
endpmatrix = beginpmatrix
9 & 0 \
11 & 11
endpmatrix.$$ And from this,
$$A = beginpmatrix
9 & 0 \
11 & 11
endpmatrix cdot beginpmatrix
0 & 3 \
17 & 24
endpmatrix = beginpmatrix
0 & 27 \
13 & 7
endpmatrix in mathrmGL(BbbZ_29).
$$



But if we use this matrix as a key and encipher the word $MARIA$, we will not take the word $ADRYD$ that we expect, so something is wrong.
Is this method correct? Do I miss something?



Thank you.







share|cite|improve this question






















  • Any help please?
    – Chris
    Jun 11 at 17:09










  • $13times 8notequiv 9pmod29$
    – Peter KoÅ¡inár
    Jun 11 at 17:10







  • 1




    Also, you might need to be careful about position of your known plaintext within the message. Remember, you are encrypting/decrypting pairs of characters, so you are looking at ciphertext split as "!I WG VI EX !Z RA DR YD" and the plaintext pairs corresponding to last two pairs would be "AR" and "IA".
    – Peter KoÅ¡inár
    Jun 11 at 17:18










  • @PeterKoÅ¡inár Thank you for your comment. Oh God. Did I take a non-existing pair?
    – Chris
    Jun 11 at 17:21






  • 1




    There are two separate issues: First is a mistake in calculation of $B^-1$ which caused MARIA not to be encrypted as ADRYD, even if considered on its own. But even with the corrected matrix, you would still get nonsensical text if you tried to decrypt the full message - since the pairs would not be aligned with those you used to find the matrix in the first place.
    – Peter KoÅ¡inár
    Jun 11 at 17:40














up vote
0
down vote

favorite













We assume that the message $$!IWGVIEX!ZRADRYD$$ has been encrypted
using Hill Cipher and with the correspondence $A=0,...,Z=25, _=26, ? =27,!=28$. We know that the last five letters of plaintext are sender's signature $MARIA$.



We want to find the deciphering matrix and read the message.




My attempt: At first we suppose that $m=2, P=C=BbbZ_29$ and $K=mathrmGL_2(BbbZ_29)$. By the hypothesis, we know that $MARIA leftrightarrow ADRYD iff (12,0,17,8,0)leftrightarrow (0,3,17,24,17)$.



This implies that, if we assume that the key matrix is $Ain mathrmGL_2(BbbZ_29)$, the diciphering function is
$$ E_A: (BbbZ_29)^2 longrightarrow (BbbZ_29)^2,\
(12,0)mapsto (12,0)cdot A =(0,3), \
(17,8) mapsto (17,8)cdot A=(17,24) $$
so,
$
beginpmatrix
12 & 0 \
17 & 8
endpmatrix cdot A = beginpmatrix
0 & 3 \
17 & 24
endpmatrix $.
We define $B:=beginpmatrix
12 & 0 \
17 & 8
endpmatrix$. Then, $det B=9 in U_29 iff B in mathrmGL(BbbZ_29)$. Also, $mathrmadj B= beginpmatrix
8 & 0 \
12 & 12
endpmatrix $ and $9^-1=13 in U_29$. So,
$$B^-1=13 beginpmatrix
8 & 0 \
12 & 12
endpmatrix = beginpmatrix
9 & 0 \
11 & 11
endpmatrix.$$ And from this,
$$A = beginpmatrix
9 & 0 \
11 & 11
endpmatrix cdot beginpmatrix
0 & 3 \
17 & 24
endpmatrix = beginpmatrix
0 & 27 \
13 & 7
endpmatrix in mathrmGL(BbbZ_29).
$$



But if we use this matrix as a key and encipher the word $MARIA$, we will not take the word $ADRYD$ that we expect, so something is wrong.
Is this method correct? Do I miss something?



Thank you.







share|cite|improve this question






















  • Any help please?
    – Chris
    Jun 11 at 17:09










  • $13times 8notequiv 9pmod29$
    – Peter KoÅ¡inár
    Jun 11 at 17:10







  • 1




    Also, you might need to be careful about position of your known plaintext within the message. Remember, you are encrypting/decrypting pairs of characters, so you are looking at ciphertext split as "!I WG VI EX !Z RA DR YD" and the plaintext pairs corresponding to last two pairs would be "AR" and "IA".
    – Peter KoÅ¡inár
    Jun 11 at 17:18










  • @PeterKoÅ¡inár Thank you for your comment. Oh God. Did I take a non-existing pair?
    – Chris
    Jun 11 at 17:21






  • 1




    There are two separate issues: First is a mistake in calculation of $B^-1$ which caused MARIA not to be encrypted as ADRYD, even if considered on its own. But even with the corrected matrix, you would still get nonsensical text if you tried to decrypt the full message - since the pairs would not be aligned with those you used to find the matrix in the first place.
    – Peter KoÅ¡inár
    Jun 11 at 17:40












up vote
0
down vote

favorite









up vote
0
down vote

favorite












We assume that the message $$!IWGVIEX!ZRADRYD$$ has been encrypted
using Hill Cipher and with the correspondence $A=0,...,Z=25, _=26, ? =27,!=28$. We know that the last five letters of plaintext are sender's signature $MARIA$.



We want to find the deciphering matrix and read the message.




My attempt: At first we suppose that $m=2, P=C=BbbZ_29$ and $K=mathrmGL_2(BbbZ_29)$. By the hypothesis, we know that $MARIA leftrightarrow ADRYD iff (12,0,17,8,0)leftrightarrow (0,3,17,24,17)$.



This implies that, if we assume that the key matrix is $Ain mathrmGL_2(BbbZ_29)$, the diciphering function is
$$ E_A: (BbbZ_29)^2 longrightarrow (BbbZ_29)^2,\
(12,0)mapsto (12,0)cdot A =(0,3), \
(17,8) mapsto (17,8)cdot A=(17,24) $$
so,
$
beginpmatrix
12 & 0 \
17 & 8
endpmatrix cdot A = beginpmatrix
0 & 3 \
17 & 24
endpmatrix $.
We define $B:=beginpmatrix
12 & 0 \
17 & 8
endpmatrix$. Then, $det B=9 in U_29 iff B in mathrmGL(BbbZ_29)$. Also, $mathrmadj B= beginpmatrix
8 & 0 \
12 & 12
endpmatrix $ and $9^-1=13 in U_29$. So,
$$B^-1=13 beginpmatrix
8 & 0 \
12 & 12
endpmatrix = beginpmatrix
9 & 0 \
11 & 11
endpmatrix.$$ And from this,
$$A = beginpmatrix
9 & 0 \
11 & 11
endpmatrix cdot beginpmatrix
0 & 3 \
17 & 24
endpmatrix = beginpmatrix
0 & 27 \
13 & 7
endpmatrix in mathrmGL(BbbZ_29).
$$



But if we use this matrix as a key and encipher the word $MARIA$, we will not take the word $ADRYD$ that we expect, so something is wrong.
Is this method correct? Do I miss something?



Thank you.







share|cite|improve this question















We assume that the message $$!IWGVIEX!ZRADRYD$$ has been encrypted
using Hill Cipher and with the correspondence $A=0,...,Z=25, _=26, ? =27,!=28$. We know that the last five letters of plaintext are sender's signature $MARIA$.



We want to find the deciphering matrix and read the message.




My attempt: At first we suppose that $m=2, P=C=BbbZ_29$ and $K=mathrmGL_2(BbbZ_29)$. By the hypothesis, we know that $MARIA leftrightarrow ADRYD iff (12,0,17,8,0)leftrightarrow (0,3,17,24,17)$.



This implies that, if we assume that the key matrix is $Ain mathrmGL_2(BbbZ_29)$, the diciphering function is
$$ E_A: (BbbZ_29)^2 longrightarrow (BbbZ_29)^2,\
(12,0)mapsto (12,0)cdot A =(0,3), \
(17,8) mapsto (17,8)cdot A=(17,24) $$
so,
$
beginpmatrix
12 & 0 \
17 & 8
endpmatrix cdot A = beginpmatrix
0 & 3 \
17 & 24
endpmatrix $.
We define $B:=beginpmatrix
12 & 0 \
17 & 8
endpmatrix$. Then, $det B=9 in U_29 iff B in mathrmGL(BbbZ_29)$. Also, $mathrmadj B= beginpmatrix
8 & 0 \
12 & 12
endpmatrix $ and $9^-1=13 in U_29$. So,
$$B^-1=13 beginpmatrix
8 & 0 \
12 & 12
endpmatrix = beginpmatrix
9 & 0 \
11 & 11
endpmatrix.$$ And from this,
$$A = beginpmatrix
9 & 0 \
11 & 11
endpmatrix cdot beginpmatrix
0 & 3 \
17 & 24
endpmatrix = beginpmatrix
0 & 27 \
13 & 7
endpmatrix in mathrmGL(BbbZ_29).
$$



But if we use this matrix as a key and encipher the word $MARIA$, we will not take the word $ADRYD$ that we expect, so something is wrong.
Is this method correct? Do I miss something?



Thank you.









share|cite|improve this question













share|cite|improve this question




share|cite|improve this question








edited Jun 11 at 21:52









Henno Brandsma

92.5k342100




92.5k342100










asked Jun 11 at 16:29









Chris

748311




748311











  • Any help please?
    – Chris
    Jun 11 at 17:09










  • $13times 8notequiv 9pmod29$
    – Peter KoÅ¡inár
    Jun 11 at 17:10







  • 1




    Also, you might need to be careful about position of your known plaintext within the message. Remember, you are encrypting/decrypting pairs of characters, so you are looking at ciphertext split as "!I WG VI EX !Z RA DR YD" and the plaintext pairs corresponding to last two pairs would be "AR" and "IA".
    – Peter KoÅ¡inár
    Jun 11 at 17:18










  • @PeterKoÅ¡inár Thank you for your comment. Oh God. Did I take a non-existing pair?
    – Chris
    Jun 11 at 17:21






  • 1




    There are two separate issues: First is a mistake in calculation of $B^-1$ which caused MARIA not to be encrypted as ADRYD, even if considered on its own. But even with the corrected matrix, you would still get nonsensical text if you tried to decrypt the full message - since the pairs would not be aligned with those you used to find the matrix in the first place.
    – Peter KoÅ¡inár
    Jun 11 at 17:40
















  • Any help please?
    – Chris
    Jun 11 at 17:09










  • $13times 8notequiv 9pmod29$
    – Peter KoÅ¡inár
    Jun 11 at 17:10







  • 1




    Also, you might need to be careful about position of your known plaintext within the message. Remember, you are encrypting/decrypting pairs of characters, so you are looking at ciphertext split as "!I WG VI EX !Z RA DR YD" and the plaintext pairs corresponding to last two pairs would be "AR" and "IA".
    – Peter KoÅ¡inár
    Jun 11 at 17:18










  • @PeterKoÅ¡inár Thank you for your comment. Oh God. Did I take a non-existing pair?
    – Chris
    Jun 11 at 17:21






  • 1




    There are two separate issues: First is a mistake in calculation of $B^-1$ which caused MARIA not to be encrypted as ADRYD, even if considered on its own. But even with the corrected matrix, you would still get nonsensical text if you tried to decrypt the full message - since the pairs would not be aligned with those you used to find the matrix in the first place.
    – Peter KoÅ¡inár
    Jun 11 at 17:40















Any help please?
– Chris
Jun 11 at 17:09




Any help please?
– Chris
Jun 11 at 17:09












$13times 8notequiv 9pmod29$
– Peter KoÅ¡inár
Jun 11 at 17:10





$13times 8notequiv 9pmod29$
– Peter KoÅ¡inár
Jun 11 at 17:10





1




1




Also, you might need to be careful about position of your known plaintext within the message. Remember, you are encrypting/decrypting pairs of characters, so you are looking at ciphertext split as "!I WG VI EX !Z RA DR YD" and the plaintext pairs corresponding to last two pairs would be "AR" and "IA".
– Peter KoÅ¡inár
Jun 11 at 17:18




Also, you might need to be careful about position of your known plaintext within the message. Remember, you are encrypting/decrypting pairs of characters, so you are looking at ciphertext split as "!I WG VI EX !Z RA DR YD" and the plaintext pairs corresponding to last two pairs would be "AR" and "IA".
– Peter KoÅ¡inár
Jun 11 at 17:18












@PeterKoÅ¡inár Thank you for your comment. Oh God. Did I take a non-existing pair?
– Chris
Jun 11 at 17:21




@PeterKoÅ¡inár Thank you for your comment. Oh God. Did I take a non-existing pair?
– Chris
Jun 11 at 17:21




1




1




There are two separate issues: First is a mistake in calculation of $B^-1$ which caused MARIA not to be encrypted as ADRYD, even if considered on its own. But even with the corrected matrix, you would still get nonsensical text if you tried to decrypt the full message - since the pairs would not be aligned with those you used to find the matrix in the first place.
– Peter KoÅ¡inár
Jun 11 at 17:40




There are two separate issues: First is a mistake in calculation of $B^-1$ which caused MARIA not to be encrypted as ADRYD, even if considered on its own. But even with the corrected matrix, you would still get nonsensical text if you tried to decrypt the full message - since the pairs would not be aligned with those you used to find the matrix in the first place.
– Peter KoÅ¡inár
Jun 11 at 17:40










1 Answer
1






active

oldest

votes

















up vote
1
down vote



accepted










You have to split the ciphertext in pairs, and your ciphertext corresponds to the following pairs of elements of $mathbbZ_29$:



(28, 8), (22, 6), (21, 8), (4, 23), (28, 25), (17, 0), (3, 17), (24, 3)


And the last 4 letters of your assumed plain text are "ARIA" (two pairs) that equal (0, 17), (8, 0) We cannot use the M, as then we'd have to guess the letter before M too, as encryption is done by pairs. But 4 unknowns with 4 equations should suffice. So if we denote by $E$ the $2 times 2$ encryption matrix we have that these 2 pairs must become the final two pairs of the cipher text, or written out as a matrix equation $EP = C$ where $P$ is a matrix of plain texts, and $C$ the corresponding ciphertexts:



$$E cdot beginbmatrix 0 & 8 \ 17 & 0 endbmatrix =
beginbmatrix 3 & 24\ 17 & 3 endbmatrix$$



As the $P$ matrix is invertible, we compute $E$ as $CP^-1$ (using mod $29$ arithmetic and the easy formula for inverses of $2 times 2$ matrices).
Then compute $D$ as $E^-1$ and you'll find a nice plaintext indeed ending in ARIA; I checked and it works out.






share|cite|improve this answer






















    Your Answer




    StackExchange.ifUsing("editor", function ()
    return StackExchange.using("mathjaxEditing", function ()
    StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix)
    StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
    );
    );
    , "mathjax-editing");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "69"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    convertImagesToLinks: true,
    noModals: false,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    noCode: true, onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













     

    draft saved


    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f2815941%2ffind-the-message-on-hill-cipher%23new-answer', 'question_page');

    );

    Post as a guest






























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    1
    down vote



    accepted










    You have to split the ciphertext in pairs, and your ciphertext corresponds to the following pairs of elements of $mathbbZ_29$:



    (28, 8), (22, 6), (21, 8), (4, 23), (28, 25), (17, 0), (3, 17), (24, 3)


    And the last 4 letters of your assumed plain text are "ARIA" (two pairs) that equal (0, 17), (8, 0) We cannot use the M, as then we'd have to guess the letter before M too, as encryption is done by pairs. But 4 unknowns with 4 equations should suffice. So if we denote by $E$ the $2 times 2$ encryption matrix we have that these 2 pairs must become the final two pairs of the cipher text, or written out as a matrix equation $EP = C$ where $P$ is a matrix of plain texts, and $C$ the corresponding ciphertexts:



    $$E cdot beginbmatrix 0 & 8 \ 17 & 0 endbmatrix =
    beginbmatrix 3 & 24\ 17 & 3 endbmatrix$$



    As the $P$ matrix is invertible, we compute $E$ as $CP^-1$ (using mod $29$ arithmetic and the easy formula for inverses of $2 times 2$ matrices).
    Then compute $D$ as $E^-1$ and you'll find a nice plaintext indeed ending in ARIA; I checked and it works out.






    share|cite|improve this answer


























      up vote
      1
      down vote



      accepted










      You have to split the ciphertext in pairs, and your ciphertext corresponds to the following pairs of elements of $mathbbZ_29$:



      (28, 8), (22, 6), (21, 8), (4, 23), (28, 25), (17, 0), (3, 17), (24, 3)


      And the last 4 letters of your assumed plain text are "ARIA" (two pairs) that equal (0, 17), (8, 0) We cannot use the M, as then we'd have to guess the letter before M too, as encryption is done by pairs. But 4 unknowns with 4 equations should suffice. So if we denote by $E$ the $2 times 2$ encryption matrix we have that these 2 pairs must become the final two pairs of the cipher text, or written out as a matrix equation $EP = C$ where $P$ is a matrix of plain texts, and $C$ the corresponding ciphertexts:



      $$E cdot beginbmatrix 0 & 8 \ 17 & 0 endbmatrix =
      beginbmatrix 3 & 24\ 17 & 3 endbmatrix$$



      As the $P$ matrix is invertible, we compute $E$ as $CP^-1$ (using mod $29$ arithmetic and the easy formula for inverses of $2 times 2$ matrices).
      Then compute $D$ as $E^-1$ and you'll find a nice plaintext indeed ending in ARIA; I checked and it works out.






      share|cite|improve this answer
























        up vote
        1
        down vote



        accepted







        up vote
        1
        down vote



        accepted






        You have to split the ciphertext in pairs, and your ciphertext corresponds to the following pairs of elements of $mathbbZ_29$:



        (28, 8), (22, 6), (21, 8), (4, 23), (28, 25), (17, 0), (3, 17), (24, 3)


        And the last 4 letters of your assumed plain text are "ARIA" (two pairs) that equal (0, 17), (8, 0) We cannot use the M, as then we'd have to guess the letter before M too, as encryption is done by pairs. But 4 unknowns with 4 equations should suffice. So if we denote by $E$ the $2 times 2$ encryption matrix we have that these 2 pairs must become the final two pairs of the cipher text, or written out as a matrix equation $EP = C$ where $P$ is a matrix of plain texts, and $C$ the corresponding ciphertexts:



        $$E cdot beginbmatrix 0 & 8 \ 17 & 0 endbmatrix =
        beginbmatrix 3 & 24\ 17 & 3 endbmatrix$$



        As the $P$ matrix is invertible, we compute $E$ as $CP^-1$ (using mod $29$ arithmetic and the easy formula for inverses of $2 times 2$ matrices).
        Then compute $D$ as $E^-1$ and you'll find a nice plaintext indeed ending in ARIA; I checked and it works out.






        share|cite|improve this answer














        You have to split the ciphertext in pairs, and your ciphertext corresponds to the following pairs of elements of $mathbbZ_29$:



        (28, 8), (22, 6), (21, 8), (4, 23), (28, 25), (17, 0), (3, 17), (24, 3)


        And the last 4 letters of your assumed plain text are "ARIA" (two pairs) that equal (0, 17), (8, 0) We cannot use the M, as then we'd have to guess the letter before M too, as encryption is done by pairs. But 4 unknowns with 4 equations should suffice. So if we denote by $E$ the $2 times 2$ encryption matrix we have that these 2 pairs must become the final two pairs of the cipher text, or written out as a matrix equation $EP = C$ where $P$ is a matrix of plain texts, and $C$ the corresponding ciphertexts:



        $$E cdot beginbmatrix 0 & 8 \ 17 & 0 endbmatrix =
        beginbmatrix 3 & 24\ 17 & 3 endbmatrix$$



        As the $P$ matrix is invertible, we compute $E$ as $CP^-1$ (using mod $29$ arithmetic and the easy formula for inverses of $2 times 2$ matrices).
        Then compute $D$ as $E^-1$ and you'll find a nice plaintext indeed ending in ARIA; I checked and it works out.







        share|cite|improve this answer














        share|cite|improve this answer



        share|cite|improve this answer








        edited Aug 24 at 4:16

























        answered Jun 11 at 21:44









        Henno Brandsma

        92.5k342100




        92.5k342100



























             

            draft saved


            draft discarded















































             


            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f2815941%2ffind-the-message-on-hill-cipher%23new-answer', 'question_page');

            );

            Post as a guest













































































            這個網誌中的熱門文章

            How to combine Bézier curves to a surface?

            Mutual Information Always Non-negative

            Why am i infinitely getting the same tweet with the Twitter Search API?