An open API service indexing awesome lists of open source software.

https://github.com/duskybomb/hill-cipher

Improved version of Hill Cipher algorithm which now accepts alphanumeric and special characters.
https://github.com/duskybomb/hill-cipher

algorithm hillcipher

Last synced: about 1 month ago
JSON representation

Improved version of Hill Cipher algorithm which now accepts alphanumeric and special characters.

Awesome Lists containing this project

README

          

# Hill-Cipher

How often we need to send someone a message and make sure no one else reads it. To encounter this problem the messages sent across to others are encoded more often than not. The algorithms used are as complex as Nazi’s Enigma and as simple as Caesar Cipher.
Hill Cipher, invented by Lester S Hill in 1029, is a polygraphic substitution cipher based on Linear Algebra and particular requires the user to have an elementary understanding of the matrices. In this project, we have developed an extended algorithm for Hill Cipher (both for encryption and decryption) and implement it on MATLAB and C++.

Source Code Files


CPP

mainhillcipher.cpp: this file contains 'main' function

encrypt.cpp: this is to write the algorithm of encrypting text using hill cipher

decrypt.cpp: this is to write the algorithm of decrypting text using hill cipher

linearalgebra.cpp: this file contains the basic operations implemented on the matrix

hillcipher.h: this is the header file which binds all the files

MATLAB

Hill_Cipher.m : this file contains 'main' function

Encrypt.m: this is to write the algorithm of encrypting text using hill cipher

Decrypt.m: this is to write the algorithm of decrypting text using hill cipher

Methodology


Encrypt()


Input

  1. A 3x3 matrix which works as a key matrix, key[3][3]

  2. A plaintext string message

Output


  1. An encoded string

Constrains


  1. -32,000 ≤ key ≤ 32,000

  2. message ∈ {A, B, C …, Y, Z}

Working


  1. Convert plaintext to ASCII number then subtract 33.

  2. Multiply key matrix with the plain text and mod92 operator

  3. Add 33 to the resultant matrix to get the ASCII code of respective elements in the matrix


Decrypt()


Output

  1. Decoded message same as the initial input message


Working

  1. Finding inverse of key

  2. Multiply the inverse of key matrix with the ASCII matrix

  3. Use mod92 operator on the matrix and add 33 to get elements in ASCII form.

## Authors

* **[Harshit Joshi](https://github.com/duskybomb)**
* **[Manas Awasthi](https://github.com/the-marvex)**
* **[Mayank Malik](https://github.com/MayankMalikk)**