Linear Algebra Applications: Cryptography

AI Thread Summary
The discussion revolves around solving a Hill 2-cipher problem involving deciphering and enciphering matrices. Participants clarify that the deciphering matrix has been correctly identified, but there is confusion regarding the calculation of the enciphering matrix. A key point is the importance of using the determinant and its reciprocal mod 26 when inverting matrices in cryptography. The correct method for obtaining the enciphering matrix involves ensuring the proper application of modular arithmetic and matrix operations. The conversation highlights the challenges in matrix inversion and the need for careful calculations to align with textbook results.
aero_zeppelin
Messages
85
Reaction score
0
If any of you guys are seeing or saw this app. for linear algebra in your classes, I could use a hand...

Homework Statement



A Hill 2-cipher is intercepted that starts with the pairs SL HK
Find the deciphering and enciphering matrices, given that the plaintext is known to start with the word ARMY.

The Attempt at a Solution



I managed to get the deciphering matrix... but how do you get the enciphering one?

Thanks!
 
Physics news on Phys.org
aero_zeppelin said:
If any of you guys are seeing or saw this app. for linear algebra in your classes, I could use a hand...

Homework Statement



A Hill 2-cipher is intercepted that starts with the pairs SL HK
Find the deciphering and enciphering matrices, given that the plaintext is known to start with the word ARMY.

The Attempt at a Solution



I managed to get the deciphering matrix... but how do you get the enciphering one?

Thanks!

Aren't these two operations inverses of one another?
 
Yes, they are. I tried inverting A^-1 (the deciphering matrix) to get A (the enciphering one), but the book says different.

I got
[7 15 ]
6 5

for the deciphering matrix.

If you invert a matrix by doing
A =
[a b ]
c d

A^-1 =
[d -b ]
-c a

You'd get
[5 -15 ] right?? But the book gives another result.
-6 7
 
No, that's not what you get. You are omitting a factor in your inverse. The correct formula is
A^{-1} = \frac{1}{ad - bc}\begin{bmatrix}d&-b \\ -c&a \end{bmatrix}

The fraction is 1/|A|. When you have found the inverse, check your work by multiplying A and A-1. You should get I from this product.
 
Ok, so if I invert A^-1 I would get A, right?

So, inverting A^-1 =
[7 15 ]
6 5

We get:
1 / -55
x
[5 -15 ]
-6 7

Which product clearly is a fraction...

The book says the result is:
A =
[7 5]
2 15

I don't know what I'm missing here... Thanks for the help btw!
 
Maybe you made a mistake in figuring out your deciphering matrix. If I work backwards from what you show as the book's answer for A, then A-1 would be
\frac{1}{95}\begin{bmatrix} 15& -5\\ -2& 7\end{bmatrix}
 
aero_zeppelin said:
Yes, they are. I tried inverting A^-1 (the deciphering matrix) to get A (the enciphering one), but the book says different.

I got
[7 15 ]
6 5

for the deciphering matrix.
How'd you get the deciphering matrix?

I find "SL" corresponds to (18, 11), so with your matrix, you would get
<br /> \begin{pmatrix} 7 &amp; 15 \\ 6 &amp; 5 \end{pmatrix}<br /> \begin{pmatrix} 18 \\ 11 \end{pmatrix} = <br /> \begin{pmatrix} 291 \\ 163 \end{pmatrix} \equiv<br /> \begin{pmatrix} 5 \\ 7 \end{pmatrix} (\text{mod }26)which corresponds to "FH", not "AR".

Am I computing this wrong or is your matrix off?
 
The deciphering matrix is right, my procedure looks fine to me and the result is the same one as in the book hehe, so I don't know what's wrong in the procedure for obtaining A, the enciphering one.

To get the deciphering matrix, you use the "intercepted" plaintext , which in this case is ARMY and put it in a matrix. Then you put the ciphertext, which in this case was given as SL HK and adjoin it to that matrix so you get the form [C l P]

Do elementary row operations (including some weird ones, like replacing numbers by their mod 26 residue) to obtain the form [ I l (A^-1)t ]

Transpose that A^-1 and you obtain the deciphering matrix! Now, to obtain the enciphering one, A ... that's where I'm stuck loll
 
Mark44 said:
Maybe you made a mistake in figuring out your deciphering matrix. If I work backwards from what you show as the book's answer for A, then A-1 would be
\frac{1}{95}\begin{bmatrix} 15&amp; -5\\ -2&amp; 7\end{bmatrix}


Well, in this case with cryptography, I think the procedure for obtaining inverses is different.

Given a matrix A, first you obtain det(A). Next you obtain its reciprocal mod 26. You use this reciprocal to do scalar multiplication with your matrix A in its "inverted form":
[d -b]
-c a]

Next, you obtain the residues mod 26 of that matrix to finally obtain A^-1
 

Similar threads

Replies
9
Views
3K
Replies
2
Views
1K
Replies
1
Views
2K
Replies
16
Views
10K
Replies
2
Views
4K
Back
Top