views:

35

answers:

1

i want to implement hill cipher but i think i have problem in understanding the algorithm itself.

the key i'll use it 2X2 matrix and i'll encode 2 charachter each time. i'll multiply the key matrix with the matrix of 2 charachters then modulus the result on 26 as this equation

C = E(K, P) = KP mod 26
where: K:key
       P:plain text

i make like this but there's something wrong. i use the example in my book to test my alogrithm. since plain text is friday and key is: int key[][] = {{5, 8}, {17, 3}}; the result should be PQCFKU.

for the first letters f , r , f= 5 , r=17 order of alphabetic letters encryption of f is (5*5 + 17*8)%26 =5 => f it should be P

I don't now where is the error that i make?? please heeeeeeeeeelp!

+2  A: 

If this: http://slidefinder.net/c/chapter_classical_encryption_techniques_jen/11206531/p2 is your book, the matrix [[5, 8] [17, 3]] is not your encryption key... it is the input matrix. 5 = F, 17 = R, 8 = I, 3 = D. K is the encryption key, which is not given in the slide. You would have to solve the linear algebra equation to get K.

If you're still having problems with the example in your book, try http://www.cs.uri.edu/cryptography/classicalhill.htm for a simple 2x2 key example with both encryption and decryption.

RD
the link is not avaialble , plz put another one , it seems u get what i want
Alaa
the link works fine for me
RD
try http://staffweb.ncnu.edu.tw/jcliu/course/security2005/ch02.ppt also
RD
yeah , this is the slides of the same book i learn , many thanx @RD , now i can go on implemnting the hill cipher
Alaa