The Hill 2-Cipher with Python

Authors

  • Noura A. A. Department of Mathematics, Faculty of Science, Derna University, Al-Qubbah branch, Libya
  • Raiga A. A. Department of Mathematics, Faculty of Science, Derna University, Al-Qubbah branch, Libya
  • Fouad S. A. Department of Mathematics, Faculty of Science, Derna University, Al-Qubbah branch, Libya

Keywords:

Plaintext, cipher text, modular29, inverse, matrices, encryption, decipheration, Python, SymPy

Abstract

This research paper focuses on the utilization of the Hill 29 cipher to encrypt short sentences using symbols and spaces between words. The Hill 29 cipher relies on linear algebra and number theory concepts. The paper deals with matrix multiplication and inverse matrix, as well as working with the modulo 29 system. The mathematical formulas of the Hill 29 cipher are presented, along with the selection of a suitable key that meets certain conditions to ensure the effectiveness of the encryption process. The cipher is applied to a sentence consisting of 13 characters and three symbols, including spaces between words, and the encryption is successfully achieved. To verify the effectiveness of the encryption, the deciphering of the obtained crossed symbols was performed. The results confirmed that the key is necessary to reconstruct the original formula with its symbols and spaces. The key is considered as a password and is represented by a 2x2 matrix. The original formula with its symbols and spaces was successfully restored, thereby proving the effectiveness of the Hill 29 cipher. It can be relied upon, provided that the appropriate key selected conditions are met. At the end of this research paper, we used a high-level, general-purpose, and very popular programming language which is called Python (latest Python 3) to ensure and get fast results without a classical manual mathematical calculation to encrypt, decrypt sentences by a special code written in Python.

Dimensions

Published

2024-01-26

How to Cite

Noura A. A., Raiga A. A., & Fouad S. A. (2024). The Hill 2-Cipher with Python. African Journal of Advanced Pure and Applied Sciences (AJAPAS), 3(1), 58–71. Retrieved from https://aaasjournals.com/index.php/ajapas/article/view/685