Reputation: 64854
I am reading about Hill Cipher encryption algorithm, from the wikipedia. I see that I have a key as a matrix that must multiply by the the matrix of values. But there are 2 things I don't understand.
I don't know the mean of (mod 26). I know it is modulo 26, but I don't know for what it is applied?
As for the second issue, I can't understand where the matrix [15 14 7] is coming from?
Any good explanation will be highly appreciated .
Upvotes: 2
Views: 22714
Reputation: 298206
26
is the length of your dictionary, which happens to be the length of the English alphabet (A to Z). Using the modulo operator allows you to map every possible output of the matrix multiplication (encryption) to a letter in the alphabet (834 = 2 (mod 26)
which is C), which lets you store the encrypted message in the form of a string of letters.
The [15 4 7]
came from the matrix [67 222 319] (mod 26)
:
The triple equals sign means that the matrix [67 222 319]
is congruent to [15 4 7]
modulo 26. Every element in the left-hand matrix should be congruent modulo 26 to the corresponding element in the right-hand matrix as well, so you apply the modulo operator to every element in the left-hand matrix to get every element in the right-hand matrix.
Upvotes: 7
Reputation: 1587
hi this is the so called modular arithmetic it's becoz there are 26 letters in the alphabet 0 is A 1 is B ... 25 is Z so what letter is 27 unclear that's why u wrap around the numbers with the modulo operator % or mod every time u get a number bigger than 25 or less then 0 u wrap around with mod 26 in that respect 27 is B becoz 27 mod 26 = 1 the matrix [15 14 7] came from [67 222 319] becoz 67 mod 26 = 15 222 mod 26 = 14 and 319 mod 26 = 7 :)
Upvotes: 0
Reputation: 824
So, you multiply both matrices together, and then you get the encrypted matrix. You then modulo every value of the resulting matrix by 26.
The mod 26 just generally means, "this value is modulo 26."
Upvotes: 0