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!