Getting the encryption matrix given letters is pretty easy:Hey guys,
I was just wondering if any of you guys could help me with the Hill Cipher, both decryption and encryption?
For encryption, how do you make an encryption matrix given plaintext- ciphertext letter pairs?
For decryption, how do you make a decryption matrix given plaintext-ciphertext letter pairs? Also, how do you decrypt when given a key and some ciphertext? Lastly, what if they ask you to produce a decryption matrix given only some plaintext (with number values all arranged in a matrix)? I was asking because at the Regionals test for my school, a couple of Hill Cipher questions where you had to produce A (the other one was THE) decryption matrix showed up, and we had no idea on how to do them.
If you guys could try to help, I would very much appreciate that!
You might as well just memorize a formula for the inverse matrixGetting the encryption matrix given letters is pretty easy:Hey guys,
I was just wondering if any of you guys could help me with the Hill Cipher, both decryption and encryption?
For encryption, how do you make an encryption matrix given plaintext- ciphertext letter pairs?
For decryption, how do you make a decryption matrix given plaintext-ciphertext letter pairs? Also, how do you decrypt when given a key and some ciphertext? Lastly, what if they ask you to produce a decryption matrix given only some plaintext (with number values all arranged in a matrix)? I was asking because at the Regionals test for my school, a couple of Hill Cipher questions where you had to produce A (the other one was THE) decryption matrix showed up, and we had no idea on how to do them.
If you guys could try to help, I would very much appreciate that!
MATH
M A
T H
12 0
19 7
The method for decryption matrix is a little more complicated:
HILL
H I
L L
7 8
11 11
first find the determinant (ad - bc = 7 * 11 - 8 * 11 = -11 = 15 mod 26) and take its multiplicative inverse mod 26 (which would be 7 in this case)
then find the adjugate matrix which is the follwing for a 2 x 2 matrix:
a b
c d
is
d -b
-c a
which would be
11 -8
-11 7
multiply the adjugate matrix by the determinant's inverse and take the values mod 26 to get:
77 -56
-77 49
25 22
1 23
Z W
B X
simple matrix multiplication should confirm, hope this helped and sorry for the formatting
You might as well just memorize a formula for the inverse matrix
Code Busters(16), DD(40), FQ(39), Forensics(36), WQ(27)
CriB(26), DP (11), FF(1), MM(14), P&P(6)
CriB(36), DD(35), FF(2), MM(20)
Yes, the fraction should be mod 26, but the formula should still apply ?You might as well just memorize a formula for the inverse matrix
One of the tables provided in most tests is the modulo inverso table which goes something like:
1 3 5 7 9 11 15 17 19 21 23 25
1 9 21 15 3 19 7 23 11 5 17 25
(they're supposed to line up)
Instead of using the fractions, we take whatever is opposite on the table of the expression (ad-bc) mod 26.
The ad-bc and d, -b, -c, a still applies, yes[Yes, the fraction should be mod 26, but the formula should still apply ?
Code Busters(16), DD(40), FQ(39), Forensics(36), WQ(27)
CriB(26), DP (11), FF(1), MM(14), P&P(6)
CriB(36), DD(35), FF(2), MM(20)
Warning: I don't do this event, so my knowledge of it is a little shaky.At regionals, I found a pretty challenging problem that I had no clue how to solve. (weighted the most on the test)
It was a Hill cipher, but instead of giving the encryption matrix or decryption matrix, they gave us 8 letters of plaintext and 8 letters of ciphertext and asked us to solve for the 2x2 encryption matrix.
I only remember the first pair, but the format was something like:
plaintext: WW aw ie ow
encryption: WE wo wi fs
I remember the first pair as WW --> WE because I spent an enormous amount of time looking for patterns in that ([-4,-4] --> [-4, 4] mod 26). All the letters had even indices except for like one or two of them. I feel like I'm just not familiar enough with modular arithmetic to solve the problem. After 40 minutes of cracking (our team managed to get most of the ciphers, and I still solved 2 others), I only knew which letters were even or odd. Any ideas on how to approach something like this?
I do understand how to get the equations, but I just have no clue how to find the actual solution. Do I just have to do some bashing? I tried a good amount during the competition, but I think my logic was off because none of my solutions worked when I plugged them back into the equations.Warning: I don't do this event, so my knowledge of it is a little shaky.At regionals, I found a pretty challenging problem that I had no clue how to solve. (weighted the most on the test)
It was a Hill cipher, but instead of giving the encryption matrix or decryption matrix, they gave us 8 letters of plaintext and 8 letters of ciphertext and asked us to solve for the 2x2 encryption matrix.
I only remember the first pair, but the format was something like:
plaintext: WW aw ie ow
encryption: WE wo wi fs
I remember the first pair as WW --> WE because I spent an enormous amount of time looking for patterns in that ([-4,-4] --> [-4, 4] mod 26). All the letters had even indices except for like one or two of them. I feel like I'm just not familiar enough with modular arithmetic to solve the problem. After 40 minutes of cracking (our team managed to get most of the ciphers, and I still solved 2 others), I only knew which letters were even or odd. Any ideas on how to approach something like this?
Convert both plaintext and encryption to a series of matrices. You should have four plaintext matrices and four encryption matrices. The goal is to find a matrix where key * plaintext = encryption. You can do this somewhat algebraically. If you use WW and WE, you get
and assuming the key is
Plug in the other pairs for more equations.
I don't know if there's an easier way, but there might be.
Note: 22 and -4 are equivalent mod 26, but I just find 22 easier to write.
Edit: aghhh forgot that A=0 and not A=1, changed some numbers
Users browsing this forum: No registered users and 3 guests