Giter Site home page Giter Site logo

cryptography's Introduction

Cryptography

A cascaded cryptography system based on an idea of using armstrong numbers and matrices for encryption/decryption which was published in a research paper.

In this program the user provides a key based on that key, file will get encrypted and same key must be used to decrypt the file. During encryption and decryption original file is divided into many chunks and process of encryption/decryption is done simultaneously which is achived by use of multithreading.

How file is processed during encryption/decryption

  1. To process file there are two classes in the program named FileProcessor and ChunkProcessor.
  2. FileProcessor class takes in the file and divided it into N (8 in our case) chunks.
  3. Each of these chunks are given to ChunkProcessor class along with key and command for encryption/decryption.
  4. Then in the constructor of this class for the process of encryption/decryption new thread gets created and activated.
  5. Each chunk gets processed byte by byte and gets stored in a target file, which in the end gets merged in the FileProcessor class.
  6. After merging and getting final encrypted/decrypted file, target files for each chunk created earlier gets deleted using os.remove().

How encryption and decryption of file is done

  1. The user provides a key using it a XOR value is generated and base value of 3 matrices is generated.
  2. The matrix is 16 * 16 matrix which has 256 elements and is used to store 1 byte of data.
  3. Now lets say the base values for 3 matrices is (24, 210, 231). Further the base values is incremented sequentially and in a cyclic manner to fill up the matrix elements, as follows:
Matrix-1 : 24, 25, 26, ..., 255, 0, 1, 2, 3, ... 23

Matrix-2 : 210, 211, 212, ..., 255, 0, 1, 2, 3, ... 209

Matrix-3 : 231, 232, 233, ..., 255, 0, 1, 2, 3, ... 230
  1. During encryption, Data (byte) to be encrypted is splitted into 2 nibbles. The higher nibble acts as row and lower one as column. By using this row, col as co-ordinates we get encoded value from matrix.
  2. During decryption, the encoded value which is unique is to be searched in the matrix and co-ordinates (row, col) of matching element are to be treated as the high nibble and lower nibble from which we get original data back.
  3. Also instead of creating an actual matrix, we simply use mathematical formula to get values from the supposed matrix in constant time.
  4. Before the encryption and decryption we also take xor of original data with XOR value that we generated earlier from user key.

cryptography's People

Contributors

anuranjanpandey avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.