Implementation of Hill cipher algorithm.
Program to generate the encryption-decryption key and perform encryption and decryption of ASCII text using the famous block cipher algorithm. This is a powerful encryption algorithm that is relatively easy to implement with a given key. The strength of the algorithm depends on the size of the block encryption matrix key; the bigger the matrix, the stronger the encryption and more difficult to break it. However, the important requirement for the matrix is that:
- matrix should be invertible - all inversion conditions should be satisfied and
- its determinant must not have any common factors with the length of character set Due to this restriction, most implementations only implement with small 3x3 encryption keys and a small subset of ASCII alphabets.
In the current implementation, I present to you an implementation for generating larger encryption keys (I have attempted upto 10x10) and an ASCII character set of 97 printable characters. Hence, a typical ASCII text file could be easily encrypted with the module. The larger character set increases the modulo of cipher and hence the matrix determinants can get very large very quickly rendering them ill-defined.
- Note
- This program uses determinant computation using LU decomposition from the file lu_decomposition.h
-
The matrix generation algorithm is very rudimentary and does not guarantee an invertible modulus matrix.
- Todo
- Better matrix generation algorithm.
- Author
- Krishna Vedala