Coder Social home page Coder Social logo

laplacexd / qtrsa Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 121 KB

Quad-Transpositional RSA (QTRSA) is a proof-of-concept encryption algorithm that is a combination of different ciphers and encryption algorithms built to test my understanding on them.

License: MIT License

Python 100.00%
abash-cipher asymmetric-cryptography caesar-cipher cryptography rsa transposition-cipher vernam-cipher vigenere-cipher encryption

qtrsa's Introduction

Quad-Transpositional RSA (QTRSA) Encryption Algrithm

Quad-Transpositional RSA (QTRSA) is a modified Rivet-Shamir-Aldeman (RSA) encryption algorithm that utilizes a cipher-mixing layer. The cipher-mixing layer is a combination of four different ciphers (Vernam, Vigenère, Caesar, and Atbash) from three different cipher types (monoalphabetic, polyalphabetic, and XOR-based cipher). These are concealed within the rows of a Columnar Transposition Cipher before the cipher is read column-wise. This algorithm results in an encryption that requires four keys to decrypt it. These keys are the following:

As a side note, this project was built in partial fulfillment for my course CS3106 - Information Assurance and Security. This course tackles concepts about cybersecurity, network security, digital forensics, and cryptography.

Setup

Prerequisites: Make sure you have Python, and the rsa python library installed. The latter can be installed via pip by using the command pip install rsa.

  1. Clone this repository.
  2. cd into the cloned repository.
  3. Read up the Usage section to know how to use the program.

Usage

The CLI program is built with three subcommands - encrypt, decrypt, and verify. If you want to test out these commands, you can use your own file or the sample file provided above which is the entire Bee Movie script.

Encrypt

The encrypt subcommand is used to encrypt a given file with QTRSA.

py qtrsa.py encrypt [-h] <file> \
    --passkey <passphrase> \
    --uniquekey <uniquephrase> \
    [--modulus <size>] \
    [--keyname <filename>] \
    [--output <filename>]

Required Arguments

  • <file> The name of the file to be encrypted.
  • --passkey -p Any passphrase of any length can work here.
  • --uniquekey -u Another passphrase but this time it must contain no-repeating characters.

Optional Arguments

  • --keyname -k The name of the file where the decryption key is to be outputted (defaults to [filename].key.pem).
  • --output -o The name of the output file. (defaults to [filename].encrypted.[ext])

Example Usage

py qtrsa.py encrypt bee-movie.txt \
    -p '^^This%Is$A#Very@Strong!Password@@!#' \
    -u 'Champion@!'

This encrypts the sample file.

Decypt

The decrypt subcommand is used to decrypt a QTRSA encrypted file.

py qtrsa.py decrypt [-h] <file> \
    --passkey <passphrase> \
    --uniquekey <uniquephrase> \
    --keyname <filename> \
    [--output <filename>]

Required Arguments

  • <file> The name of the QTRSA encrypted file to be decrypted.
  • --passkey -p The passphrase used to encrypt the file.
  • --uniquekey -u The unique passphrase used to encrypt the file.
  • --keyname -k The filename of the decryption key.

Optional Arguments

  • --output -o The name of the output file. (defaults to [filename].decrypted.[ext])

Example Usage

py qtrsa.py decrypt bee-movie.encrypted.txt \
    -p '^^This%Is$A#Very@Strong!Password@@!#' \
    -u 'Champion@!' \
    -k bee-movie.key.pem

This decryptes the encrypted sample file, if it exists.

Verify

The verify subcommand is used to verify the hash values of files. This can be used to get the hash of any number of files, and their hashes are compared to the first file supplied to the command. This is used to verify whether the encryption algorithm successfully decrypted the ciphertext back to its plaintext version without any alterations.

py qtrsa.py [-h] [files ...]

Required Arguments

  • [files ...] These takes any number of files that you want to hash. The first file on this list will be used as the basis, and every other files' hash will be compared to it.

Example Usage

py qtrsa.py verify bee-movie.txt bee-movie.decrypted.txt

This compares the hash values of the decrypted sample file and the actual sample file itself.

Contributing

Unfortunately, I am not accepting pull requests, since this is a one-time project. However, feel free to fork this project, and improve on it!

License

MIT

qtrsa's People

Contributors

laplacexd 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.