A Hill cipher is a cipher based on matrix multiplication. To encrypt a message of length in an alphabet of size , pick some key of size and compute . To decrypt the message, apply .
For this problem, given a message (encrypted for ), the encryption key , and the encryption key , rekey the message to become .
The input will be supplied in c. The final output must also be placed in c.
Input
A- original encryption key.B- target encryption key.n- size of the Hill cipher key matrices.l- alphabet modulus.c- ciphertext encrypted underA, provided in place.
Output
c- the input vector modified in place to become .