You have to get the key and then multiply the key by the text. The decipher key is the inverse of the encipher key in mod whatever
kolosick.m188
Junior Poster in Training
72 posts since Jun 2009
Reputation Points: 16
Solved Threads: 16
jempag,
It is kinda hard for anyone, to predict your exact approach into writing a program to either encrypt or decrypt. Even if they are familiar with the cipher.
Therefore, in order for you to get better suggestions I guess it would be compulsory for you to first take the time in explaining the approach by which you wish to achieve your goal. And also provide some code that you have already implemented. When that would be done, It would be easier for everyone to then Understand your approach and might lead into helping you to get the solution.
AS Far as HILL Cipher goes.
Basically You must teach the computer Matrix Multiplication.
Considering that you are using a 2x2 Matrix as a key, I guess it would be quite easy to do so.
Now when you are either Encrypting or Decrypting . Make sure that you use 2 letters(1x2) letter matrix To make multiplication possible.
You could use an Enumeration to make symbolic constants representing each letter and the value for that letter.(This approach would require you to use a tokenizer .)
Sky Diploma
Practically a Posting Shark
865 posts since Mar 2008
Reputation Points: 673
Solved Threads: 131
Well if
we think that
int matrix [2][2];
int determinant = ((matrix[0][0])*(matrix[1][1])) - ( (-matrix[0][1])) *(-matrix[1][0]))
Would give up the determinant. I hope i closed all the braces correctly.
Sky Diploma
Practically a Posting Shark
865 posts since Mar 2008
Reputation Points: 673
Solved Threads: 131