GithubHelp home page GithubHelp logo

cmg189 / singlekey_exploit Goto Github PK

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

Exploiting the many-time pad vulnerability

License: MIT License

Python 100.00%
bitwise-operation decryption many-time-pad python3 python

singlekey_exploit's Introduction

Single Key Exploit

This program demonstrates the single key exploit by way of ciphertext decryption. The single key exploit has also been know to go by other names including one-time pad and many-time pad.

Table of Contents

  1. Description
  2. Program Output
  3. Execution
  4. Function Headers
  5. Resources

Description

Single Key Exploit is a python program that decrypts ciphertext. This ciphertext has been encrypted using a single key for each message, leading to the single key exploit. Upon execution, the program will display the plaintext message that will be encrypted. Then it will try to decrypt as much of the encrypted text as possible. The resulting decrypted text will be output to the user.

Program Output

Execution

To execute run the command python3 main.py

Function Headers

display_info()
  • Description:

    Outputs plain text to be encrypted

  • Parameters:

    None

  • Return:

    msgs List containing strings to be encrypted

    key List of bytes representing the encryption key


make_cipher(text, key)
  • Description:

    Creates a list of strings representing ciphertext

  • Parameters:

    text List representing plaintext

    key List of bytes representing the encryption key

  • Return:

    cipher List containing ciphertext


encrypt(msg, key)
  • Description:

    Encrypts plain text using an encryption key

  • Parameters:

    mag String to be encrypted

    key List representing encryption key

  • Return:

    bytes String representing encrypted text in hexadecimal


preprocess(text)
  • Description:

    Turns encrypted text into hexadecimal and initializes a list of dashes acting as placeholders

  • Parameters:

    text List containing ciphertext

  • Return:

    hex List representing hexadecimal representation of encrypted text

    place_holders List containing dashes -


break_encryption(encrypted_text, decrypted_text)
  • Description:

    Attempts to break encryption by utilizing XOR operations

  • Parameters:

    encrypted_text List containing the ciphertext

    decrypted_text List of placeholders to store decrypted text

  • Return:

    cracked_cipher List of decrypted text


ascii_space(not_cracked, current_char, columns)
  • Description:

    Checks a character to determine if it is a space

  • Parameters:

    not_cracked List containing text that has not been decrypted

    current_char Char representing the current character that is being test to determine if it is a space

    columns Int representing the index of the current character we are testing

  • Return:

    Bool True if a space is found, False otherwise


output_text(text)
  • Description:

    Outputs the decrypted text

  • Parameters:

    text List containing decrypted text

  • Return:

    None

Resources

To learn more about this encryption vulnerability refer to this article: One-time Pad

singlekey_exploit's People

Contributors

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